From: Andrea Arcangeli <aarcange@redhat.com> To: Johannes Weiner <hannes@cmpxchg.org> Cc: linux-mm@kvack.org, Rik van Riel <riel@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Mel Gorman <mgorman@suse.de>, Andrew Morton <akpm@linux-foundation.org>, Minchan Kim <minchan.kim@gmail.com>, Hugh Dickins <hughd@google.com>, KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [patch 5/5] mm: refault distance-based file cache sizing Date: Wed, 2 May 2012 03:57:41 +0200 [thread overview] Message-ID: <20120502015741.GE22923@redhat.com> (raw) In-Reply-To: <1335861713-4573-6-git-send-email-hannes@cmpxchg.org> On Tue, May 01, 2012 at 10:41:53AM +0200, Johannes Weiner wrote: > frequently used active page. Instead, for each refault with a > distance smaller than the size of the active list, we deactivate an Shouldn't this be the size of active list + size of inactive list? If the active list is 500M, inactive 500M and the new working set is 600M, the refault distance will be 600M, it won't be smaller than the size of the active list, and it won't deactivate the active list as it should and it won't be detected as working set. Only the refault distance bigger than inactive+active should not deactivate the active list if I understand how this works correctly. > @@ -1726,6 +1728,11 @@ zonelist_scan: > if ((alloc_flags & ALLOC_CPUSET) && > !cpuset_zone_allowed_softwall(zone, gfp_mask)) > continue; > + if ((alloc_flags & ALLOC_WMARK_LOW) && > + current->refault_distance && > + !workingset_zone_alloc(zone, current->refault_distance, > + &distance, &active)) > + continue; > /* > * When allocating a page cache page for writing, we > * want to get it from a zone that is within its dirty It's a bit hard to see how this may not run oom prematurely if the distance is always bigger, this is just an implementation question and maybe I'm missing a fallback somewhere where we actually allocate memory from whatever place in case no place is ideal. > + /* > + * Lower zones may not even be full, and free pages are > + * potential inactive space, too. But the dirty reserve is > + * not available to page cache due to lowmem reserves and the > + * kswapd watermark. Don't include it. > + */ > + zone_free = zone_page_state(zone, NR_FREE_PAGES); > + if (zone_free > zone->dirty_balance_reserve) > + zone_free -= zone->dirty_balance_reserve; > + else > + zone_free = 0; Maybe also remove the high wmark from the sum? It can be some hundred meg so it's better to take it into account, to have a more accurate math and locate the best zone that surely fits. For the same reason it looks like the lowmem reserve should also be taken into account, on the full sum. > + if (missing >= zone_active + zone_free) { This seems a place where to add the zone_inactive too according to my comment on top.
WARNING: multiple messages have this Message-ID (diff)
From: Andrea Arcangeli <aarcange@redhat.com> To: Johannes Weiner <hannes@cmpxchg.org> Cc: linux-mm@kvack.org, Rik van Riel <riel@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Mel Gorman <mgorman@suse.de>, Andrew Morton <akpm@linux-foundation.org>, Minchan Kim <minchan.kim@gmail.com>, Hugh Dickins <hughd@google.com>, KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [patch 5/5] mm: refault distance-based file cache sizing Date: Wed, 2 May 2012 03:57:41 +0200 [thread overview] Message-ID: <20120502015741.GE22923@redhat.com> (raw) In-Reply-To: <1335861713-4573-6-git-send-email-hannes@cmpxchg.org> On Tue, May 01, 2012 at 10:41:53AM +0200, Johannes Weiner wrote: > frequently used active page. Instead, for each refault with a > distance smaller than the size of the active list, we deactivate an Shouldn't this be the size of active list + size of inactive list? If the active list is 500M, inactive 500M and the new working set is 600M, the refault distance will be 600M, it won't be smaller than the size of the active list, and it won't deactivate the active list as it should and it won't be detected as working set. Only the refault distance bigger than inactive+active should not deactivate the active list if I understand how this works correctly. > @@ -1726,6 +1728,11 @@ zonelist_scan: > if ((alloc_flags & ALLOC_CPUSET) && > !cpuset_zone_allowed_softwall(zone, gfp_mask)) > continue; > + if ((alloc_flags & ALLOC_WMARK_LOW) && > + current->refault_distance && > + !workingset_zone_alloc(zone, current->refault_distance, > + &distance, &active)) > + continue; > /* > * When allocating a page cache page for writing, we > * want to get it from a zone that is within its dirty It's a bit hard to see how this may not run oom prematurely if the distance is always bigger, this is just an implementation question and maybe I'm missing a fallback somewhere where we actually allocate memory from whatever place in case no place is ideal. > + /* > + * Lower zones may not even be full, and free pages are > + * potential inactive space, too. But the dirty reserve is > + * not available to page cache due to lowmem reserves and the > + * kswapd watermark. Don't include it. > + */ > + zone_free = zone_page_state(zone, NR_FREE_PAGES); > + if (zone_free > zone->dirty_balance_reserve) > + zone_free -= zone->dirty_balance_reserve; > + else > + zone_free = 0; Maybe also remove the high wmark from the sum? It can be some hundred meg so it's better to take it into account, to have a more accurate math and locate the best zone that surely fits. For the same reason it looks like the lowmem reserve should also be taken into account, on the full sum. > + if (missing >= zone_active + zone_free) { This seems a place where to add the zone_inactive too according to my comment on top. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-05-02 1:58 UTC|newest] Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-05-01 8:41 [patch 0/5] refault distance-based file cache sizing Johannes Weiner 2012-05-01 8:41 ` Johannes Weiner 2012-05-01 8:41 ` [patch 1/5] mm: readahead: move radix tree hole searching here Johannes Weiner 2012-05-01 8:41 ` Johannes Weiner 2012-05-01 21:06 ` Rik van Riel 2012-05-01 21:06 ` Rik van Riel 2012-05-01 8:41 ` [patch 2/5] mm + fs: prepare for non-page entries in page cache Johannes Weiner 2012-05-01 8:41 ` Johannes Weiner 2012-05-01 19:02 ` Andrew Morton 2012-05-01 19:02 ` Andrew Morton 2012-05-01 20:15 ` Johannes Weiner 2012-05-01 20:15 ` Johannes Weiner 2012-05-01 20:24 ` Andrew Morton 2012-05-01 20:24 ` Andrew Morton 2012-05-01 21:14 ` Rik van Riel 2012-05-01 21:14 ` Rik van Riel 2012-05-01 21:29 ` Johannes Weiner 2012-05-01 21:29 ` Johannes Weiner 2012-05-01 8:41 ` [patch 3/5] mm + fs: store shadow pages " Johannes Weiner 2012-05-01 8:41 ` Johannes Weiner 2012-05-01 8:41 ` [patch 4/5] mm + fs: provide refault distance to page cache instantiations Johannes Weiner 2012-05-01 8:41 ` Johannes Weiner 2012-05-01 9:30 ` Peter Zijlstra 2012-05-01 9:30 ` Peter Zijlstra 2012-05-01 9:30 ` Peter Zijlstra 2012-05-01 9:55 ` Johannes Weiner 2012-05-01 9:55 ` Johannes Weiner 2012-05-01 9:58 ` Peter Zijlstra 2012-05-01 9:58 ` Peter Zijlstra 2012-05-01 9:58 ` Peter Zijlstra 2012-05-01 8:41 ` [patch 5/5] mm: refault distance-based file cache sizing Johannes Weiner 2012-05-01 8:41 ` Johannes Weiner 2012-05-01 14:13 ` Minchan Kim 2012-05-01 14:13 ` Minchan Kim 2012-05-01 15:38 ` Johannes Weiner 2012-05-01 15:38 ` Johannes Weiner 2012-05-02 5:21 ` Minchan Kim 2012-05-02 5:21 ` Minchan Kim 2012-05-02 1:57 ` Andrea Arcangeli [this message] 2012-05-02 1:57 ` Andrea Arcangeli 2012-05-02 6:23 ` Johannes Weiner 2012-05-02 6:23 ` Johannes Weiner 2012-05-02 15:11 ` Andrea Arcangeli 2012-05-02 15:11 ` Andrea Arcangeli 2012-05-01 19:08 ` [patch 0/5] " Andrew Morton 2012-05-01 19:08 ` Andrew Morton 2012-05-01 21:19 ` Rik van Riel 2012-05-01 21:19 ` Rik van Riel 2012-05-01 21:26 ` Andrew Morton 2012-05-01 21:26 ` Andrew Morton 2012-05-02 1:10 ` Andrea Arcangeli 2012-05-02 1:10 ` Andrea Arcangeli 2012-05-03 13:15 ` Johannes Weiner 2012-05-03 13:15 ` Johannes Weiner 2012-05-16 5:25 ` nai.xia 2012-05-16 5:25 ` nai.xia 2012-05-16 6:51 ` Johannes Weiner 2012-05-16 6:51 ` Johannes Weiner 2012-05-16 12:56 ` nai.xia 2012-05-16 12:56 ` nai.xia 2012-05-17 21:08 ` Johannes Weiner 2012-05-17 21:08 ` Johannes Weiner 2012-05-18 3:44 ` Nai Xia 2012-05-18 3:44 ` Nai Xia 2012-05-18 15:07 ` Rik van Riel 2012-05-18 15:07 ` Rik van Riel 2012-05-18 15:30 ` Nai Xia 2012-05-18 15:30 ` Nai Xia 2012-05-18 15:30 ` Nai Xia 2012-05-17 13:11 ` Rik van Riel 2012-05-17 13:11 ` Rik van Riel 2012-05-18 5:03 ` Nai Xia 2012-05-18 5:03 ` Nai Xia 2012-05-18 5:03 ` Nai Xia
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20120502015741.GE22923@redhat.com \ --to=aarcange@redhat.com \ --cc=akpm@linux-foundation.org \ --cc=hannes@cmpxchg.org \ --cc=hughd@google.com \ --cc=kosaki.motohiro@jp.fujitsu.com \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mgorman@suse.de \ --cc=minchan.kim@gmail.com \ --cc=peterz@infradead.org \ --cc=riel@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.