From: Vlastimil Babka <vbabka@suse.cz> To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org> Cc: linux-kernel@vger.kernel.org, Andrea Arcangeli <aarcange@redhat.com>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Rik van Riel <riel@redhat.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Mel Gorman <mgorman@techsingularity.net>, David Rientjes <rientjes@google.com>, Michal Hocko <mhocko@suse.com>, Johannes Weiner <hannes@cmpxchg.org>, Vlastimil Babka <vbabka@suse.cz> Subject: [PATCH v2 1/5] mm, kswapd: remove bogus check of balance_classzone_idx Date: Mon, 8 Feb 2016 14:38:07 +0100 [thread overview] Message-ID: <1454938691-2197-2-git-send-email-vbabka@suse.cz> (raw) In-Reply-To: <1454938691-2197-1-git-send-email-vbabka@suse.cz> During work on kcompactd integration I have spotted a confusing check of balance_classzone_idx, which I believe is bogus. The balanced_classzone_idx is filled by balance_pgdat() as the highest zone it attempted to balance. This was introduced by commit dc83edd941f4 ("mm: kswapd: use the classzone idx that kswapd was using for sleeping_prematurely()"). The intention is that (as expressed in today's function names), the value used for kswapd_shrink_zone() calls in balance_pgdat() is the same as for the decisions in kswapd_try_to_sleep(). An unwanted side-effect of that commit was breaking the checks in kswapd() whether there was another kswapd_wakeup with a tighter (=lower) classzone_idx. Commits 215ddd6664ce ("mm: vmscan: only read new_classzone_idx from pgdat when reclaiming successfully") and d2ebd0f6b895 ("kswapd: avoid unnecessary rebalance after an unsuccessful balancing") tried to fixed, but apparently introduced a bogus check that this patch removes. Consider zone indexes X < Y < Z, where: - Z is the value used for the first kswapd wakeup. - Y is returned as balanced_classzone_idx, which means zones with index higher than Y (including Z) were found to be unreclaimable. - X is the value used for the second kswapd wakeup The new wakeup with value X means that kswapd is now supposed to balance harder all zones with index <= X. But instead, due to Y < Z, it will go sleep and won't read the new value X. This is subtly wrong. The effect of this patch is that kswapd will react better in some situations, where e.g. the first wakeup is for ZONE_DMA32, the second is for ZONE_DMA, and due to unreclaimable ZONE_NORMAL. Before this patch, kswapd would go sleep instead of reclaiming ZONE_DMA harder. I expect these situations are very rare, and more value is in better maintainability due to the removal of confusing and bogus check. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> --- mm/vmscan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 18b3767136f4..c67df4831565 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3451,8 +3451,7 @@ static int kswapd(void *p) * new request of a similar or harder type will succeed soon * so consider going to sleep on the basis we reclaimed at */ - if (balanced_classzone_idx >= new_classzone_idx && - balanced_order == new_order) { + if (balanced_order == new_order) { new_order = pgdat->kswapd_max_order; new_classzone_idx = pgdat->classzone_idx; pgdat->kswapd_max_order = 0; -- 2.7.0
WARNING: multiple messages have this Message-ID (diff)
From: Vlastimil Babka <vbabka@suse.cz> To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org> Cc: linux-kernel@vger.kernel.org, Andrea Arcangeli <aarcange@redhat.com>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Rik van Riel <riel@redhat.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Mel Gorman <mgorman@techsingularity.net>, David Rientjes <rientjes@google.com>, Michal Hocko <mhocko@suse.com>, Johannes Weiner <hannes@cmpxchg.org>, Vlastimil Babka <vbabka@suse.cz> Subject: [PATCH v2 1/5] mm, kswapd: remove bogus check of balance_classzone_idx Date: Mon, 8 Feb 2016 14:38:07 +0100 [thread overview] Message-ID: <1454938691-2197-2-git-send-email-vbabka@suse.cz> (raw) In-Reply-To: <1454938691-2197-1-git-send-email-vbabka@suse.cz> During work on kcompactd integration I have spotted a confusing check of balance_classzone_idx, which I believe is bogus. The balanced_classzone_idx is filled by balance_pgdat() as the highest zone it attempted to balance. This was introduced by commit dc83edd941f4 ("mm: kswapd: use the classzone idx that kswapd was using for sleeping_prematurely()"). The intention is that (as expressed in today's function names), the value used for kswapd_shrink_zone() calls in balance_pgdat() is the same as for the decisions in kswapd_try_to_sleep(). An unwanted side-effect of that commit was breaking the checks in kswapd() whether there was another kswapd_wakeup with a tighter (=lower) classzone_idx. Commits 215ddd6664ce ("mm: vmscan: only read new_classzone_idx from pgdat when reclaiming successfully") and d2ebd0f6b895 ("kswapd: avoid unnecessary rebalance after an unsuccessful balancing") tried to fixed, but apparently introduced a bogus check that this patch removes. Consider zone indexes X < Y < Z, where: - Z is the value used for the first kswapd wakeup. - Y is returned as balanced_classzone_idx, which means zones with index higher than Y (including Z) were found to be unreclaimable. - X is the value used for the second kswapd wakeup The new wakeup with value X means that kswapd is now supposed to balance harder all zones with index <= X. But instead, due to Y < Z, it will go sleep and won't read the new value X. This is subtly wrong. The effect of this patch is that kswapd will react better in some situations, where e.g. the first wakeup is for ZONE_DMA32, the second is for ZONE_DMA, and due to unreclaimable ZONE_NORMAL. Before this patch, kswapd would go sleep instead of reclaiming ZONE_DMA harder. I expect these situations are very rare, and more value is in better maintainability due to the removal of confusing and bogus check. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> --- mm/vmscan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 18b3767136f4..c67df4831565 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3451,8 +3451,7 @@ static int kswapd(void *p) * new request of a similar or harder type will succeed soon * so consider going to sleep on the basis we reclaimed at */ - if (balanced_classzone_idx >= new_classzone_idx && - balanced_order == new_order) { + if (balanced_order == new_order) { new_order = pgdat->kswapd_max_order; new_classzone_idx = pgdat->classzone_idx; pgdat->kswapd_max_order = 0; -- 2.7.0 -- 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/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-02-08 13:39 UTC|newest] Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-02-08 13:38 [PATCH v2 0/5] introduce kcompactd and stop compacting in kswapd Vlastimil Babka 2016-02-08 13:38 ` Vlastimil Babka 2016-02-08 13:38 ` Vlastimil Babka [this message] 2016-02-08 13:38 ` [PATCH v2 1/5] mm, kswapd: remove bogus check of balance_classzone_idx Vlastimil Babka 2016-02-08 13:38 ` [PATCH v2 2/5] mm, compaction: introduce kcompactd Vlastimil Babka 2016-02-08 13:38 ` Vlastimil Babka 2016-03-02 6:09 ` Joonsoo Kim 2016-03-02 6:09 ` Joonsoo Kim 2016-03-02 12:25 ` Vlastimil Babka 2016-03-02 12:25 ` Vlastimil Babka 2016-02-08 13:38 ` [PATCH v2 3/5] mm, memory hotplug: small cleanup in online_pages() Vlastimil Babka 2016-02-08 13:38 ` Vlastimil Babka 2016-02-08 13:38 ` [PATCH v2 4/5] mm, kswapd: replace kswapd compaction with waking up kcompactd Vlastimil Babka 2016-02-08 13:38 ` Vlastimil Babka 2016-02-08 22:58 ` Andrew Morton 2016-02-08 22:58 ` Andrew Morton 2016-02-09 10:53 ` Vlastimil Babka 2016-02-09 10:53 ` Vlastimil Babka 2016-02-09 10:21 ` Vlastimil Babka 2016-02-09 10:21 ` Vlastimil Babka 2016-03-01 14:14 ` Vlastimil Babka 2016-03-01 14:14 ` Vlastimil Babka 2016-03-02 6:33 ` Joonsoo Kim 2016-03-02 6:33 ` Joonsoo Kim 2016-03-02 10:04 ` Vlastimil Babka 2016-03-02 10:04 ` Vlastimil Babka 2016-03-02 13:57 ` Joonsoo Kim 2016-03-02 13:57 ` Joonsoo Kim 2016-03-02 14:09 ` Vlastimil Babka 2016-03-02 14:09 ` Vlastimil Babka 2016-03-02 14:22 ` Joonsoo Kim 2016-03-02 14:22 ` Joonsoo Kim 2016-03-02 14:40 ` Vlastimil Babka 2016-03-02 14:40 ` Vlastimil Babka 2016-03-02 14:59 ` Joonsoo Kim 2016-03-02 14:59 ` Joonsoo Kim 2016-03-02 15:22 ` Vlastimil Babka 2016-03-02 15:22 ` Vlastimil Babka 2016-03-04 23:25 ` Andrew Morton 2016-03-04 23:25 ` Andrew Morton 2016-03-07 9:45 ` Vlastimil Babka 2016-03-07 9:45 ` Vlastimil Babka 2016-03-09 13:47 ` Vlastimil Babka 2016-03-09 13:47 ` Vlastimil Babka 2016-03-09 13:50 ` Vlastimil Babka 2016-03-09 13:50 ` Vlastimil Babka 2016-03-02 12:27 ` Vlastimil Babka 2016-03-02 12:27 ` Vlastimil Babka 2016-02-08 13:38 ` [PATCH v2 5/5] mm, compaction: adapt isolation_suitable flushing to kcompactd Vlastimil Babka 2016-02-08 13:38 ` Vlastimil Babka 2016-03-01 14:44 ` Vlastimil Babka 2016-03-01 14:44 ` Vlastimil Babka 2016-03-09 15:52 ` [PATCH v2 0/5] introduce kcompactd and stop compacting in kswapd Michal Hocko 2016-03-09 15:52 ` Michal Hocko 2016-03-10 8:38 ` Vlastimil Babka 2016-03-10 8:38 ` Vlastimil Babka
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=1454938691-2197-2-git-send-email-vbabka@suse.cz \ --to=vbabka@suse.cz \ --cc=aarcange@redhat.com \ --cc=akpm@linux-foundation.org \ --cc=hannes@cmpxchg.org \ --cc=iamjoonsoo.kim@lge.com \ --cc=kirill.shutemov@linux.intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mgorman@techsingularity.net \ --cc=mhocko@suse.com \ --cc=riel@redhat.com \ --cc=rientjes@google.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.