From patchwork Tue Jun 11 02:11:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 17769 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f199.google.com (mail-gh0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 882042397B for ; Tue, 11 Jun 2013 02:13:18 +0000 (UTC) Received: by mail-gh0-f199.google.com with SMTP id g14sf4369426ghb.6 for ; Mon, 10 Jun 2013 19:13:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to: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=+kuUKJWNYXi/k2KI7qNpV8hJ+hGnj4VHcbrSbVVtN5g=; b=UkclizKelMAau5Yf3sToLysK8NnjuDUCLOan8qdOueJd7QatgBYfH6XBKH753gM7Ad pDErO1u19bJkqSfziL61/y9VpBuQ3tDBUZEjN10FFp/SWKEZalQxi2+khyJ6WBmwLEDe GjwTEY2596hZFPLDUThJKRsQA8CdsJumCuD7dWLYHXz1z5//aG9hh/giBoqsBdFG5Bvv xlQ+Qe2nt5Lz4GTc0Sxx0s7cjKG8AkE6r2/Xcxtdl3qEmNAr/OHTuT6xLQV2HDi0o2Yr aLORSNeRmfGEgtm9YCphKGhFfdsAqo7SB4BLGM1c2lZVoAs6pwLRscE/uZyqLcsCnb5+ t8Uw== X-Received: by 10.224.215.68 with SMTP id hd4mr9829438qab.5.1370916798270; Mon, 10 Jun 2013 19:13:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.76.65 with SMTP id i1ls3199258qew.2.gmail; Mon, 10 Jun 2013 19:13:18 -0700 (PDT) X-Received: by 10.52.29.19 with SMTP id f19mr6128731vdh.100.1370916798043; Mon, 10 Jun 2013 19:13:18 -0700 (PDT) Received: from mail-vb0-x22f.google.com (mail-vb0-x22f.google.com [2607:f8b0:400c:c02::22f]) by mx.google.com with ESMTPS id ml6si6215545vec.11.2013.06.10.19.13.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 19:13:18 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22f is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22f; Received: by mail-vb0-f47.google.com with SMTP id x14so4867683vbb.34 for ; Mon, 10 Jun 2013 19:13:18 -0700 (PDT) X-Received: by 10.58.106.77 with SMTP id gs13mr7271230veb.22.1370916797937; Mon, 10 Jun 2013 19:13:17 -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.221.10.206 with SMTP id pb14csp90927vcb; Mon, 10 Jun 2013 19:13:17 -0700 (PDT) X-Received: by 10.66.8.138 with SMTP id r10mr16538383paa.55.1370916796934; Mon, 10 Jun 2013 19:13:16 -0700 (PDT) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by mx.google.com with ESMTPS id av8si5930987pbd.69.2013.06.10.19.13.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 19:13:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.180 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.180; Received: by mail-pd0-f180.google.com with SMTP id 10so8002664pdi.25 for ; Mon, 10 Jun 2013 19:13:16 -0700 (PDT) X-Received: by 10.68.175.68 with SMTP id by4mr12521491pbc.53.1370916796377; Mon, 10 Jun 2013 19:13:16 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id nt2sm12427175pbc.17.2013.06.10.19.13.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 19:13:15 -0700 (PDT) From: John Stultz To: minchan.kim@lge.com Cc: Minchan Kim , John Stultz Subject: [PATCH 10/13] vrange: Get rid of dependency that all pages is from a zone in shrink_page_list Date: Mon, 10 Jun 2013 19:11:29 -0700 Message-Id: <1370916692-9576-11-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1370916692-9576-1-git-send-email-john.stultz@linaro.org> References: <1370916692-9576-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQnNiCp8jedPxLZSAiK7LaeUQInWvD7ypURiyru0jlO+kHTLCfQwPn9qI6HmYpr2kce1XCMg X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22f 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 c75e0ac..4107c07 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -78,6 +78,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 */ @@ -715,7 +718,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++; @@ -786,6 +790,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. @@ -964,7 +972,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);