All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jianguo Wu <wujianguo@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiang Liu <liuj97@gmail.com>, Wen Congyang <wency@cn.fujitsu.com>,
	David Rientjes <rientjes@google.com>,
	Jiang Liu <jiang.liu@huawei.com>,
	Maciej Rutecki <maciej.rutecki@gmail.com>,
	Chris Clayton <chris2553@googlemail.com>,
	"Rafael J . Wysocki" <rjw@sisk.pl>, Mel Gorman <mgorman@suse.de>,
	Minchan Kim <minchan@kernel.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Michal Hocko <mhocko@suse.cz>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFT PATCH v2 4/5] mm: provide more accurate estimation of pages occupied by memmap
Date: Thu, 29 Nov 2012 10:25:01 +0800	[thread overview]
Message-ID: <50B6C77D.7070307@huawei.com> (raw)
In-Reply-To: <20121128155221.df369ce4.akpm@linux-foundation.org>

On 2012/11/29 7:52, Andrew Morton wrote:

> On Wed, 21 Nov 2012 23:09:46 +0800
> Jiang Liu <liuj97@gmail.com> wrote:
> 
>> Subject: Re: [RFT PATCH v2 4/5] mm: provide more accurate estimation of pages occupied by memmap
> 
> How are people to test this?  "does it boot"?
> 

I have tested this in x86_64, it does boot.

Node 0, zone      DMA
  pages free     3972
        min      1
        low      1
        high     1
        scanned  0
        spanned  4080
        present  3979
        managed  3972

Node 0, zone    DMA32
  pages free     448783
        min      172
        low      215
        high     258
        scanned  0
        spanned  1044480
        present  500799
        managed  444545

Node 0, zone   Normal
  pages free     2375547
        min      1394
        low      1742
        high     2091
        scanned  0
        spanned  3670016
        present  3670016
        managed  3585105

Thanks,
Jianguo Wu

>> If SPARSEMEM is enabled, it won't build page structures for
>> non-existing pages (holes) within a zone, so provide a more accurate
>> estimation of pages occupied by memmap if there are bigger holes within
>> the zone.
>>
>> And pages for highmem zones' memmap will be allocated from lowmem, so
>> charge nr_kernel_pages for that.
>>
>> ...
>>
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -4442,6 +4442,26 @@ void __init set_pageblock_order(void)
>>  
>>  #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
>>  
>> +static unsigned long calc_memmap_size(unsigned long spanned_pages,
>> +				      unsigned long present_pages)
>> +{
>> +	unsigned long pages = spanned_pages;
>> +
>> +	/*
>> +	 * Provide a more accurate estimation if there are holes within
>> +	 * the zone and SPARSEMEM is in use. If there are holes within the
>> +	 * zone, each populated memory region may cost us one or two extra
>> +	 * memmap pages due to alignment because memmap pages for each
>> +	 * populated regions may not naturally algined on page boundary.
>> +	 * So the (present_pages >> 4) heuristic is a tradeoff for that.
>> +	 */
>> +	if (spanned_pages > present_pages + (present_pages >> 4) &&
>> +	    IS_ENABLED(CONFIG_SPARSEMEM))
>> +		pages = present_pages;
>> +
>> +	return PAGE_ALIGN(pages * sizeof(struct page)) >> PAGE_SHIFT;
>> +}
>> +
> 
> I spose we should do this, although it makes no difference as the
> compiler will inline calc_memmap_size() into its caller:
> 
> --- a/mm/page_alloc.c~mm-provide-more-accurate-estimation-of-pages-occupied-by-memmap-fix
> +++ a/mm/page_alloc.c
> @@ -4526,8 +4526,8 @@ void __init set_pageblock_order(void)
>  
>  #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
>  
> -static unsigned long calc_memmap_size(unsigned long spanned_pages,
> -				      unsigned long present_pages)
> +static unsigned long __paginginit calc_memmap_size(unsigned long spanned_pages,
> +						   unsigned long present_pages)
>  {
>  	unsigned long pages = spanned_pages;
>  
> 
> 
> .
> 



--
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: Jianguo Wu <wujianguo@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiang Liu <liuj97@gmail.com>, Wen Congyang <wency@cn.fujitsu.com>,
	David Rientjes <rientjes@google.com>,
	Jiang Liu <jiang.liu@huawei.com>,
	Maciej Rutecki <maciej.rutecki@gmail.com>,
	Chris Clayton <chris2553@googlemail.com>,
	"Rafael J . Wysocki" <rjw@sisk.pl>, Mel Gorman <mgorman@suse.de>,
	Minchan Kim <minchan@kernel.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Michal Hocko <mhocko@suse.cz>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [RFT PATCH v2 4/5] mm: provide more accurate estimation of pages occupied by memmap
Date: Thu, 29 Nov 2012 10:25:01 +0800	[thread overview]
Message-ID: <50B6C77D.7070307@huawei.com> (raw)
In-Reply-To: <20121128155221.df369ce4.akpm@linux-foundation.org>

On 2012/11/29 7:52, Andrew Morton wrote:

> On Wed, 21 Nov 2012 23:09:46 +0800
> Jiang Liu <liuj97@gmail.com> wrote:
> 
>> Subject: Re: [RFT PATCH v2 4/5] mm: provide more accurate estimation of pages occupied by memmap
> 
> How are people to test this?  "does it boot"?
> 

I have tested this in x86_64, it does boot.

Node 0, zone      DMA
  pages free     3972
        min      1
        low      1
        high     1
        scanned  0
        spanned  4080
        present  3979
        managed  3972

Node 0, zone    DMA32
  pages free     448783
        min      172
        low      215
        high     258
        scanned  0
        spanned  1044480
        present  500799
        managed  444545

Node 0, zone   Normal
  pages free     2375547
        min      1394
        low      1742
        high     2091
        scanned  0
        spanned  3670016
        present  3670016
        managed  3585105

Thanks,
Jianguo Wu

>> If SPARSEMEM is enabled, it won't build page structures for
>> non-existing pages (holes) within a zone, so provide a more accurate
>> estimation of pages occupied by memmap if there are bigger holes within
>> the zone.
>>
>> And pages for highmem zones' memmap will be allocated from lowmem, so
>> charge nr_kernel_pages for that.
>>
>> ...
>>
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -4442,6 +4442,26 @@ void __init set_pageblock_order(void)
>>  
>>  #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
>>  
>> +static unsigned long calc_memmap_size(unsigned long spanned_pages,
>> +				      unsigned long present_pages)
>> +{
>> +	unsigned long pages = spanned_pages;
>> +
>> +	/*
>> +	 * Provide a more accurate estimation if there are holes within
>> +	 * the zone and SPARSEMEM is in use. If there are holes within the
>> +	 * zone, each populated memory region may cost us one or two extra
>> +	 * memmap pages due to alignment because memmap pages for each
>> +	 * populated regions may not naturally algined on page boundary.
>> +	 * So the (present_pages >> 4) heuristic is a tradeoff for that.
>> +	 */
>> +	if (spanned_pages > present_pages + (present_pages >> 4) &&
>> +	    IS_ENABLED(CONFIG_SPARSEMEM))
>> +		pages = present_pages;
>> +
>> +	return PAGE_ALIGN(pages * sizeof(struct page)) >> PAGE_SHIFT;
>> +}
>> +
> 
> I spose we should do this, although it makes no difference as the
> compiler will inline calc_memmap_size() into its caller:
> 
> --- a/mm/page_alloc.c~mm-provide-more-accurate-estimation-of-pages-occupied-by-memmap-fix
> +++ a/mm/page_alloc.c
> @@ -4526,8 +4526,8 @@ void __init set_pageblock_order(void)
>  
>  #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
>  
> -static unsigned long calc_memmap_size(unsigned long spanned_pages,
> -				      unsigned long present_pages)
> +static unsigned long __paginginit calc_memmap_size(unsigned long spanned_pages,
> +						   unsigned long present_pages)
>  {
>  	unsigned long pages = spanned_pages;
>  
> 
> 
> .
> 




  reply	other threads:[~2012-11-29  2:25 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06  1:31 [PATCH] mm: fix a regression with HIGHMEM introduced by changeset 7f1290f2f2a4d Jiang Liu
2012-11-06  1:31 ` Jiang Liu
2012-11-06 10:23 ` Chris Clayton
2012-11-06 10:23   ` Chris Clayton
2012-11-06 20:43 ` Andrew Morton
2012-11-06 20:43   ` Andrew Morton
2012-11-14 14:52   ` Jiang Liu
2012-11-14 14:52     ` Jiang Liu
2012-11-15  9:22     ` Wen Congyang
2012-11-15  9:22       ` Wen Congyang
2012-11-15 11:28       ` Bob Liu
2012-11-15 11:28         ` Bob Liu
2012-11-15 14:23         ` Wen Congyang
2012-11-15 14:23           ` Wen Congyang
2012-11-15 15:40       ` Jiang Liu
2012-11-15 15:40         ` Jiang Liu
2012-11-15 21:41         ` David Rientjes
2012-11-15 21:41           ` David Rientjes
2012-11-15 19:24     ` Andrew Morton
2012-11-15 19:24       ` Andrew Morton
2012-11-15 21:17       ` Chris Clayton
2012-11-15 21:17         ` Chris Clayton
2012-11-15 21:27       ` David Rientjes
2012-11-15 21:27         ` David Rientjes
2012-11-18 16:07       ` [RFT PATCH v1 0/5] fix up inaccurate zone->present_pages Jiang Liu
2012-11-18 16:07         ` Jiang Liu
2012-11-18 16:07         ` [RFT PATCH v1 1/5] mm: introduce new field "managed_pages" to struct zone Jiang Liu
2012-11-18 16:07           ` Jiang Liu
2012-11-19 23:38           ` Andrew Morton
2012-11-19 23:38             ` Andrew Morton
2012-11-20 14:56             ` Jiang Liu
2012-11-20 14:56               ` Jiang Liu
2012-11-20 19:31               ` Andrew Morton
2012-11-20 19:31                 ` Andrew Morton
2012-11-21 14:36                 ` Jiang Liu
2012-11-21 14:36                   ` Jiang Liu
2012-11-21 19:31                   ` Andrew Morton
2012-11-21 19:31                     ` Andrew Morton
2012-11-21 15:06                 ` [RFT PATCH v2 " Jiang Liu
2012-11-21 15:06                   ` Jiang Liu
2012-11-18 16:07         ` [RFT PATCH v1 2/5] mm: replace zone->present_pages with zone->managed_pages if appreciated Jiang Liu
2012-11-18 16:07           ` Jiang Liu
2012-11-18 16:07         ` [RFT PATCH v1 3/5] mm: set zone->present_pages to number of existing pages in the zone Jiang Liu
2012-11-18 16:07           ` Jiang Liu
2012-11-18 16:07         ` [RFT PATCH v1 4/5] mm: provide more accurate estimation of pages occupied by memmap Jiang Liu
2012-11-18 16:07           ` Jiang Liu
2012-11-19 23:42           ` Andrew Morton
2012-11-19 23:42             ` Andrew Morton
2012-11-20 15:18             ` Jiang Liu
2012-11-20 15:18               ` Jiang Liu
2012-11-20 19:19               ` Andrew Morton
2012-11-20 19:19                 ` Andrew Morton
2012-11-21 14:52                 ` Jiang Liu
2012-11-21 14:52                   ` Jiang Liu
2012-11-21 19:35                   ` Andrew Morton
2012-11-21 19:35                     ` Andrew Morton
2012-11-22 16:17                     ` Jiang Liu
2012-11-22 16:17                       ` Jiang Liu
2012-11-21 15:09                 ` [RFT PATCH v2 " Jiang Liu
2012-11-21 15:09                   ` Jiang Liu
2012-11-28 23:52                   ` Andrew Morton
2012-11-28 23:52                     ` Andrew Morton
2012-11-29  2:25                     ` Jianguo Wu [this message]
2012-11-29  2:25                       ` Jianguo Wu
2012-11-29 10:52                     ` Chris Clayton
2012-11-29 10:52                       ` Chris Clayton
2012-12-02 19:55                       ` Chris Clayton
2012-12-02 19:55                         ` Chris Clayton
2012-12-03  7:26                         ` Chris Clayton
2012-12-03  7:26                           ` Chris Clayton
2012-12-03 23:17                         ` Andrew Morton
2012-12-03 23:17                           ` Andrew Morton
2012-12-04  1:21                           ` Jiang Liu
2012-12-04  1:21                             ` Jiang Liu
2012-12-04 10:05                           ` Chris Clayton
2012-12-04 10:05                             ` Chris Clayton
2012-11-20  2:15           ` [RFT PATCH v1 " Jaegeuk Hanse
2012-11-20  2:15             ` Jaegeuk Hanse
2012-11-18 16:07         ` [RFT PATCH v1 5/5] mm: increase totalram_pages when free pages allocated by bootmem allocator Jiang Liu
2012-11-18 16:07           ` Jiang Liu
2012-11-18 20:36         ` [RFT PATCH v1 0/5] fix up inaccurate zone->present_pages Chris Clayton
2012-11-18 20:36           ` Chris Clayton
2012-11-22  9:23           ` Chris Clayton
2012-11-22  9:23             ` Chris Clayton
2012-11-26  9:46             ` Chris Clayton
2012-11-26  9:46               ` Chris Clayton
2012-11-19 21:36         ` Maciej Rutecki
2012-11-19 21:36           ` Maciej Rutecki
2012-11-20 16:03           ` Jiang Liu
2012-11-20 16:03             ` Jiang Liu
2012-11-20  2:13         ` Jaegeuk Hanse
2012-11-20  2:13           ` Jaegeuk Hanse
2012-11-20  2:43           ` Jiang Liu
2012-11-20  2:43             ` Jiang Liu
2012-11-20  3:20             ` Jaegeuk Hanse
2012-11-20  3:20               ` Jaegeuk Hanse
2012-11-20  3:46               ` Jiang Liu
2012-11-20  3:46                 ` Jiang Liu

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=50B6C77D.7070307@huawei.com \
    --to=wujianguo@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris2553@googlemail.com \
    --cc=jiang.liu@huawei.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuj97@gmail.com \
    --cc=maciej.rutecki@gmail.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=minchan@kernel.org \
    --cc=rientjes@google.com \
    --cc=rjw@sisk.pl \
    --cc=wency@cn.fujitsu.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.