All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xishi Qiu <qiuxishi@huawei.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH] mm/hotplug: remove unnecessary BUG_ON in __offline_pages()
Date: Thu, 1 Aug 2013 09:35:12 +0800	[thread overview]
Message-ID: <51F9BB50.1010905@huawei.com> (raw)
In-Reply-To: <51F9419F.6070306@intel.com>

On 2013/8/1 0:55, Dave Hansen wrote:

> On 07/29/2013 11:49 PM, Xishi Qiu wrote:
>> I think we can remove "BUG_ON(start_pfn >= end_pfn)" in __offline_pages(),
>> because in memory_block_action() "nr_pages = PAGES_PER_SECTION * sections_per_block" 
>> is always greater than 0.
> ...
>> --- a/mm/memory_hotplug.c
>> +++ b/mm/memory_hotplug.c
>> @@ -1472,7 +1472,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
>>  	struct zone *zone;
>>  	struct memory_notify arg;
>>  
>> -	BUG_ON(start_pfn >= end_pfn);
>>  	/* at least, alignment against pageblock is necessary */
>>  	if (!IS_ALIGNED(start_pfn, pageblock_nr_pages))
>>  		return -EINVAL;
> 
> I think you're saying that you don't see a way to hit this BUG_ON() in
> practice.  That does appear to be true, unless sections_per_block ended
> up 0 or negative.  The odds of getting in to this code if
> 'sections_per_block' was bogus are pretty small.
> 

Yes, I find there is an only to hit this BUG_ON() in v3.11, and "sections_per_block"
seems to be always greater than 0.

> Or, is this a theoretical thing that folks might run in to when adding
> new features or developing?  It's in a cold path and the cost of the
> check is miniscule.  The original author (cc'd) also saw a need to put
> this in probably because he actually ran in to this.
> 

In v2.6.32, If info->length==0, this way may hit this BUG_ON().
acpi_memory_disable_device()
	remove_memory(info->start_addr, info->length)
		offline_pages()

Later Fujitsu's patch rename this function and the BUG_ON() is unnecessary.

Thanks,
Xishi Qiu

> In any case, it looks fairly safe to me:
> 
> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
> .
> 


--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Xishi Qiu <qiuxishi@huawei.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: <linux-mm@kvack.org>, LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH] mm/hotplug: remove unnecessary BUG_ON in __offline_pages()
Date: Thu, 1 Aug 2013 09:35:12 +0800	[thread overview]
Message-ID: <51F9BB50.1010905@huawei.com> (raw)
In-Reply-To: <51F9419F.6070306@intel.com>

On 2013/8/1 0:55, Dave Hansen wrote:

> On 07/29/2013 11:49 PM, Xishi Qiu wrote:
>> I think we can remove "BUG_ON(start_pfn >= end_pfn)" in __offline_pages(),
>> because in memory_block_action() "nr_pages = PAGES_PER_SECTION * sections_per_block" 
>> is always greater than 0.
> ...
>> --- a/mm/memory_hotplug.c
>> +++ b/mm/memory_hotplug.c
>> @@ -1472,7 +1472,6 @@ static int __ref __offline_pages(unsigned long start_pfn,
>>  	struct zone *zone;
>>  	struct memory_notify arg;
>>  
>> -	BUG_ON(start_pfn >= end_pfn);
>>  	/* at least, alignment against pageblock is necessary */
>>  	if (!IS_ALIGNED(start_pfn, pageblock_nr_pages))
>>  		return -EINVAL;
> 
> I think you're saying that you don't see a way to hit this BUG_ON() in
> practice.  That does appear to be true, unless sections_per_block ended
> up 0 or negative.  The odds of getting in to this code if
> 'sections_per_block' was bogus are pretty small.
> 

Yes, I find there is an only to hit this BUG_ON() in v3.11, and "sections_per_block"
seems to be always greater than 0.

> Or, is this a theoretical thing that folks might run in to when adding
> new features or developing?  It's in a cold path and the cost of the
> check is miniscule.  The original author (cc'd) also saw a need to put
> this in probably because he actually ran in to this.
> 

In v2.6.32, If info->length==0, this way may hit this BUG_ON().
acpi_memory_disable_device()
	remove_memory(info->start_addr, info->length)
		offline_pages()

Later Fujitsu's patch rename this function and the BUG_ON() is unnecessary.

Thanks,
Xishi Qiu

> In any case, it looks fairly safe to me:
> 
> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
> .
> 



  reply	other threads:[~2013-08-01  1:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30  6:49 [PATCH] mm/hotplug: remove unnecessary BUG_ON in __offline_pages() Xishi Qiu
2013-07-30  6:49 ` Xishi Qiu
2013-07-30 15:39 ` Toshi Kani
2013-07-30 15:39   ` Toshi Kani
2013-07-31 16:55 ` Dave Hansen
2013-07-31 16:55   ` Dave Hansen
2013-08-01  1:35   ` Xishi Qiu [this message]
2013-08-01  1:35     ` Xishi Qiu

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=51F9BB50.1010905@huawei.com \
    --to=qiuxishi@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 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.