From patchwork Fri May 3 18:27:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 16704 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4C07223905 for ; Fri, 3 May 2013 18:27:46 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id 1sf3469350qec.2 for ; Fri, 03 May 2013 11:27:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=6H358DZI3e5Y8nTAzpz0LddnfAEVgezpckMHPwtluNU=; b=gs7uAnPa6N02Ed3PDYoNviuVjCD98eGVVA5IzFE7i9acg+x0QPRPzTPbIYRV9J9157 4Nmb96wVoMO8HaqtPskgXlte+CDyHRyhr0SUfsRhICsmwwnI3ZaPmOiNK6vbtqu0RvyC 7DpwMDQgoPTVYEq/LjeuxKn1AY46EuIhVn+xPGUT9ELmwRoy81c9ad0TBgWCLgP5quVq ksQuQ7tYgBDvJmp3SKm+LJ6krE096PsiYMXYqmWyvlgNovp+mc4+22O0xeDnuSFPYqEv czwZyS3z/a5OBsMOmJs60++K9ynqUMBs6jWCbzaGSE69AeEc7hemcgjEO0L5VI7JYi+z X+cA== X-Received: by 10.236.80.106 with SMTP id j70mr9178005yhe.11.1367605656135; Fri, 03 May 2013 11:27:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.119.129 with SMTP id ku1ls1943670qeb.49.gmail; Fri, 03 May 2013 11:27:35 -0700 (PDT) X-Received: by 10.220.253.8 with SMTP id my8mr4062029vcb.23.1367605655659; Fri, 03 May 2013 11:27:35 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id b4si5541706vdw.83.2013.05.03.11.27.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 11:27:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id gd11so1730000vcb.0 for ; Fri, 03 May 2013 11:27:35 -0700 (PDT) X-Received: by 10.220.242.73 with SMTP id lh9mr3960446vcb.49.1367605655551; Fri, 03 May 2013 11:27:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp34388veb; Fri, 3 May 2013 11:27:34 -0700 (PDT) X-Received: by 10.66.148.132 with SMTP id ts4mr16305751pab.19.1367605654605; Fri, 03 May 2013 11:27:34 -0700 (PDT) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by mx.google.com with ESMTPS id mv11si8617406pab.107.2013.05.03.11.27.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 11:27:34 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.170 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.170; Received: by mail-pd0-f170.google.com with SMTP id 10so1048289pdi.29 for ; Fri, 03 May 2013 11:27:34 -0700 (PDT) X-Received: by 10.66.88.38 with SMTP id bd6mr16288136pab.184.1367605654226; Fri, 03 May 2013 11:27:34 -0700 (PDT) Received: from localhost.localdomain (c-24-21-54-107.hsd1.or.comcast.net. [24.21.54.107]) by mx.google.com with ESMTPSA id qh4sm13792406pac.8.2013.05.03.11.27.32 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 11:27:33 -0700 (PDT) From: John Stultz To: Minchan Kim Cc: John Stultz Subject: [PATCH 09/12] vrange: Get rid of dependency that all pages is from a zone in shrink_page_list Date: Fri, 3 May 2013 11:27:13 -0700 Message-Id: <1367605636-18284-10-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367605636-18284-1-git-send-email-john.stultz@linaro.org> References: <1367605636-18284-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQlvJ757nRYI9Hn+Hivrfb1kTRUWRIo0Z8cC6cvA23gj7bM3IP28ewLffCmgKLI8/ZHR1pnO X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Minchan Kim Now shrink_page_list expect all pages come from a same zone but it's too limited to use it. This patch removes the dependency and add may_discard in scan_control so next patch can use shrink_page_list with pages from multiple zones. Signed-off-by: Minchan Kim Signed-off-by: John Stultz --- mm/vmscan.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index f3549e8..0ce9cb4 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -77,6 +77,9 @@ struct scan_control { /* Can pages be swapped as part of reclaim? */ int may_swap; + /* Discard pages in vrange */ + int may_discard; + int order; /* Scan (total_size >> priority) pages at once */ @@ -714,7 +717,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, goto keep; VM_BUG_ON(PageActive(page)); - VM_BUG_ON(page_zone(page) != zone); + if (zone) + VM_BUG_ON(page_zone(page) != zone); sc->nr_scanned++; @@ -785,6 +789,10 @@ static unsigned long shrink_page_list(struct list_head *page_list, ; /* try to reclaim the page below */ } + /* Fail to discard a page and returns a page to caller */ + if (sc->may_discard) + goto keep_locked; + /* * Anonymous process memory has backing store? * Try to allocate it some swap space here. @@ -963,7 +971,8 @@ keep: * back off and wait for congestion to clear because further reclaim * will encounter the same problem */ - if (nr_dirty && nr_dirty == nr_congested && global_reclaim(sc)) + if (nr_dirty && nr_dirty == nr_congested && global_reclaim(sc) && + zone) zone_set_flag(zone, ZONE_CONGESTED); free_hot_cold_page_list(&free_pages, 1);