From patchwork Fri Mar 14 21:42:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 26313 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5A11B202DD for ; Fri, 14 Mar 2014 21:42:56 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id il7sf7013329vcb.5 for ; Fri, 14 Mar 2014 14:42:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=93L1ObKB5dYN/U2IMj1BDvofMASQcojCNlw5tbr5qmQ=; b=F03EvkArZNTGeDY955yHt0eBsVOdOsrvyrsDd5ccgInFXQNqzFBWZO/ZbyXSQUttZ+ 33GTzM2mePBXeIcD4pQu0Ba9ge4lOfOlb3Ns+YNKnj9ZGDsgH3i4RXkyZQwJYemilTqc ysmBrv/UUBSnvVNHTrfIlmzLqdWrZwt706iz3Sodx28KthKFAov0wku96geidPopZace oQxrG92itw59+0EYphzeJSra6SvURDZlwzjKwuwzxN2WvQQf+9yBQYLl2LAyg2lxkgrY hwE3WzGnUNauCH4eb1H+9l6zXG8vjihXwBV27CEWDQxhDVa3s/2L5rf1C/SqrUl0OZZ3 yXKA== X-Gm-Message-State: ALoCoQkCbWS07MX0iXgBJ8cklvrAFWoe5XQRurfhfzwSG0Po+PD2QnFjeAJ7fPtYYD8cMgXHZ1fr X-Received: by 10.236.125.6 with SMTP id y6mr3790470yhh.3.1394833375891; Fri, 14 Mar 2014 14:42:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.49.113 with SMTP id p104ls942238qga.41.gmail; Fri, 14 Mar 2014 14:42:55 -0700 (PDT) X-Received: by 10.58.34.101 with SMTP id y5mr8352153vei.8.1394833375800; Fri, 14 Mar 2014 14:42:55 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id j20si2572740vcx.19.2014.03.14.14.42.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 14:42:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id jw12so3450294veb.27 for ; Fri, 14 Mar 2014 14:42:55 -0700 (PDT) X-Received: by 10.52.34.137 with SMTP id z9mr6916342vdi.12.1394833375722; Fri, 14 Mar 2014 14:42:55 -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.220.78.9 with SMTP id i9csp53767vck; Fri, 14 Mar 2014 14:42:55 -0700 (PDT) X-Received: by 10.68.43.2 with SMTP id s2mr11526026pbl.60.1394833374974; Fri, 14 Mar 2014 14:42:54 -0700 (PDT) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by mx.google.com with ESMTPS id wh10si3738876pab.304.2014.03.14.14.42.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 14:42:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.44 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.160.44; Received: by mail-pb0-f44.google.com with SMTP id rp16so3158352pbb.17 for ; Fri, 14 Mar 2014 14:42:54 -0700 (PDT) X-Received: by 10.66.251.42 with SMTP id zh10mr11630343pac.84.1394833374571; Fri, 14 Mar 2014 14:42:54 -0700 (PDT) Received: from buildbox.hsd1.or.comcast.net (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id n6sm19738922pbj.22.2014.03.14.14.42.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 14:42:53 -0700 (PDT) From: John Stultz To: Dave Hansen Cc: John Stultz Subject: [PATCH] vmscan: Age anonymous memory even when swap is off. Date: Fri, 14 Mar 2014 14:42:51 -0700 Message-Id: <1394833371-10878-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.182 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: , Currently we don't shrink/scan the anonymous lrus when swap is off. This is problematic for volatile range purging on swapless systems/ This patch naievely changes the vmscan code to continue scanning and shrinking the lrus even when there is no swap. It has performance issues. Signed-off-by: John Stultz --- mm/vmscan.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index c5c0ee0..1c400fd 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -155,9 +155,8 @@ static unsigned long zone_reclaimable_pages(struct zone *zone) nr = zone_page_state(zone, NR_ACTIVE_FILE) + zone_page_state(zone, NR_INACTIVE_FILE); - if (get_nr_swap_pages() > 0) - nr += zone_page_state(zone, NR_ACTIVE_ANON) + - zone_page_state(zone, NR_INACTIVE_ANON); + nr += zone_page_state(zone, NR_ACTIVE_ANON) + + zone_page_state(zone, NR_INACTIVE_ANON); return nr; } @@ -1764,13 +1763,6 @@ static int inactive_anon_is_low_global(struct zone *zone) */ static int inactive_anon_is_low(struct lruvec *lruvec) { - /* - * If we don't have swap space, anonymous page deactivation - * is pointless. - */ - if (!total_swap_pages) - return 0; - if (!mem_cgroup_disabled()) return mem_cgroup_inactive_anon_is_low(lruvec); @@ -1880,12 +1872,6 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, if (!global_reclaim(sc)) force_scan = true; - /* If we have no swap space, do not bother scanning anon pages. */ - if (!sc->may_swap || (get_nr_swap_pages() <= 0)) { - scan_balance = SCAN_FILE; - goto out; - } - /* * Global reclaim will swap to prevent OOM even with no * swappiness, but memcg users want to use this knob to @@ -2048,7 +2034,6 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc) if (nr[lru]) { nr_to_scan = min(nr[lru], SWAP_CLUSTER_MAX); nr[lru] -= nr_to_scan; - nr_reclaimed += shrink_list(lru, nr_to_scan, lruvec, sc); } @@ -2181,8 +2166,8 @@ static inline bool should_continue_reclaim(struct zone *zone, */ pages_for_compaction = (2UL << sc->order); inactive_lru_pages = zone_page_state(zone, NR_INACTIVE_FILE); - if (get_nr_swap_pages() > 0) - inactive_lru_pages += zone_page_state(zone, NR_INACTIVE_ANON); + inactive_lru_pages += zone_page_state(zone, NR_INACTIVE_ANON); + if (sc->nr_reclaimed < pages_for_compaction && inactive_lru_pages > pages_for_compaction) return true; @@ -2726,9 +2711,6 @@ static void age_active_anon(struct zone *zone, struct scan_control *sc) { struct mem_cgroup *memcg; - if (!total_swap_pages) - return; - memcg = mem_cgroup_iter(NULL, NULL, NULL); do { struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);