linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: page_alloc: avoid false page outside zone error info
Date: Wed, 5 Jul 2023 09:43:58 +0800	[thread overview]
Message-ID: <ef553b86-dd65-e64c-8c2e-fb4a5451e7c4@huawei.com> (raw)
In-Reply-To: <20230704093819.48443ca7789043a640c8a07a@linux-foundation.org>

On 2023/7/5 0:38, Andrew Morton wrote:
> On Tue, 4 Jul 2023 20:36:00 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
> 
>> On 2023/7/4 20:13, Matthew Wilcox wrote:
>>> On Tue, Jul 04, 2023 at 07:18:23PM +0800, Miaohe Lin wrote:
>>>> @@ -470,6 +470,8 @@ static int page_outside_zone_boundaries(struct zone *zone, struct page *page)
>>>>  		sp = zone->spanned_pages;
>>>>  		if (!zone_spans_pfn(zone, pfn))
>>>>  			ret = 1;
>>>> +		else
>>>> +			ret = 0;
>>>
>>> Surely 'ret = zone_spans_pfn(zone, pfn);' ?
>>
>> Do you mean 'ret = !zone_spans_pfn(zone, pfn);'?  This format looks fine to me.
>>
>>>
>>> Also, did you spot this by inspection or do you have a test-case or bug
>>> report?  Should this have a Fixes: tag?
>>
>> This is from code inspection. The race window should be really small thus hard to trigger
>> in real world. And yes, it seems Fixes tag is a really ancient commit:
>>
>> 	Fixes: bdc8cb984576 ("[PATCH] memory hotplug locking: zone span seqlock")
>>
> 
> Thanks.  I updated the changelog:
> 
> : If pfn is outside zone boundaries in the first round, ret will be set to
> : 1.  But if pfn is changed to inside the zone boundaries in zone span
> : seqretry path, ret is still set to 1 leading to false page outside zone
> : error info.
> : 
> : This is from code inspection.  The race window should be really small thus
> : hard to trigger in real world.
> : 
> : Link: https://lkml.kernel.org/r/20230704111823.940331-1-linmiaohe@huawei.com
> : Fixes: bdc8cb984576 ("[PATCH] memory hotplug locking: zone span seqlock")
> 
> and I made the change suggested by Matthew:
> 
> --- a/mm/page_alloc.c~mm-page_alloc-avoid-false-page-outside-zone-error-info-fix
> +++ a/mm/page_alloc.c
> @@ -468,10 +468,7 @@ static int page_outside_zone_boundaries(
>  		seq = zone_span_seqbegin(zone);
>  		start_pfn = zone->zone_start_pfn;
>  		sp = zone->spanned_pages;
> -		if (!zone_spans_pfn(zone, pfn))
> -			ret = 1;
> -		else
> -			ret = 0;
> +		ret = !zone_spans_pfn(zone, pfn);
>  	} while (zone_span_seqretry(zone, seq));

These changes look good to me. Thanks for doing this.



      reply	other threads:[~2023-07-05  1:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04 11:18 Miaohe Lin
2023-07-04 12:13 ` Matthew Wilcox
2023-07-04 12:36   ` Miaohe Lin
2023-07-04 16:38     ` Andrew Morton
2023-07-05  1:43       ` Miaohe Lin [this message]

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=ef553b86-dd65-e64c-8c2e-fb4a5451e7c4@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox