All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Yury Norov <yury.norov@gmail.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	David Rientjes <rientjes@google.com>,
	Michal Hocko <mhocko@kernel.org>,
	Will Deacon <will.deacon@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm, page_alloc: Fix a division by zero error when boosting watermarks
Date: Wed, 13 Feb 2019 14:15:18 +0000	[thread overview]
Message-ID: <20190213141518.GS9565@techsingularity.net> (raw)
In-Reply-To: <295be99c-d09a-5572-fa49-2673a62c295b@suse.cz>

On Wed, Feb 13, 2019 at 02:42:36PM +0100, Vlastimil Babka wrote:
> On 2/13/19 2:19 PM, Mel Gorman wrote:
> > Yury Norov reported that an arm64 KVM instance could not boot since after
> > v5.0-rc1 and could addressed by reverting the patches
> > 
> > 1c30844d2dfe272d58c ("mm: reclaim small amounts of memory when an external
> > 73444bc4d8f92e46a20 ("mm, page_alloc: do not wake kswapd with zone lock held")
> > 
> > The problem is that a division by zero error is possible if boosting occurs
> > either very early in boot or if the high watermark is very small. This
> > patch checks for the conditions and avoids boosting in those cases.
> 
> Hmm is it really a division by zero? The following line sets max_boost to
> pageblock_nr_pages if it's zero. And where would the division happen anyway?
> 
> So I wonder what's going on, your patch should AFAICS only take effect when
> zone->_watermark[WMARK_HIGH] is 0 or 1 to begin with, otherwise max_boost is at
> least 2?
> 

The issue can occur if pageblock_nr_pages is also zero or not yet
initialised. It means the changelog is misleading because it  has to
trigger very early in boot as happened with Yury.

> Also upon closer look, I think that (prior to the patch), boost_watermark()
> could be reduced (thanks to the max+min capping) to
> 
> zone->watermark_boost = pageblock_nr_pages
> 

I don't think it's worth being fancy about it if we're hitting
fragmentation issues that early in boot.

-- 
Mel Gorman
SUSE Labs

WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mgorman@techsingularity.net>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrea Arcangeli <aarcange@redhat.com>,
	Yury Norov <yury.norov@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org, Michal Hocko <mhocko@kernel.org>,
	linux-mm@kvack.org, David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] mm, page_alloc: Fix a division by zero error when boosting watermarks
Date: Wed, 13 Feb 2019 14:15:18 +0000	[thread overview]
Message-ID: <20190213141518.GS9565@techsingularity.net> (raw)
In-Reply-To: <295be99c-d09a-5572-fa49-2673a62c295b@suse.cz>

On Wed, Feb 13, 2019 at 02:42:36PM +0100, Vlastimil Babka wrote:
> On 2/13/19 2:19 PM, Mel Gorman wrote:
> > Yury Norov reported that an arm64 KVM instance could not boot since after
> > v5.0-rc1 and could addressed by reverting the patches
> > 
> > 1c30844d2dfe272d58c ("mm: reclaim small amounts of memory when an external
> > 73444bc4d8f92e46a20 ("mm, page_alloc: do not wake kswapd with zone lock held")
> > 
> > The problem is that a division by zero error is possible if boosting occurs
> > either very early in boot or if the high watermark is very small. This
> > patch checks for the conditions and avoids boosting in those cases.
> 
> Hmm is it really a division by zero? The following line sets max_boost to
> pageblock_nr_pages if it's zero. And where would the division happen anyway?
> 
> So I wonder what's going on, your patch should AFAICS only take effect when
> zone->_watermark[WMARK_HIGH] is 0 or 1 to begin with, otherwise max_boost is at
> least 2?
> 

The issue can occur if pageblock_nr_pages is also zero or not yet
initialised. It means the changelog is misleading because it  has to
trigger very early in boot as happened with Yury.

> Also upon closer look, I think that (prior to the patch), boost_watermark()
> could be reduced (thanks to the max+min capping) to
> 
> zone->watermark_boost = pageblock_nr_pages
> 

I don't think it's worth being fancy about it if we're hitting
fragmentation issues that early in boot.

-- 
Mel Gorman
SUSE Labs

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-02-13 14:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 13:19 [PATCH] mm, page_alloc: Fix a division by zero error when boosting watermarks Mel Gorman
2019-02-13 13:19 ` Mel Gorman
2019-02-13 13:20 ` Will Deacon
2019-02-13 13:20   ` Will Deacon
2019-02-13 13:42 ` Vlastimil Babka
2019-02-13 13:42   ` Vlastimil Babka
2019-02-13 14:15   ` Mel Gorman [this message]
2019-02-13 14:15     ` Mel Gorman
2019-02-13 14:30 ` [PATCH] mm, page_alloc: Fix a division by zero error when boosting watermarks v2 Mel Gorman
2019-02-13 14:30   ` Mel Gorman
2019-02-13 14:31   ` Vlastimil Babka
2019-02-13 14:31     ` 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=20190213141518.GS9565@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    --cc=will.deacon@arm.com \
    --cc=yury.norov@gmail.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: link
Be 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.