linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
	Nishanth Aravamudan <nacc@us.ibm.com>,
	Adam Litke <agl@us.ibm.com>, Andy Whitcroft <apw@canonical.com>,
	eric.whitney@hp.com
Subject: Re: [PATCH 3/5] Use per hstate nodes_allowed to constrain huge page allocation
Date: Wed, 17 Jun 2009 14:39:11 +0100	[thread overview]
Message-ID: <20090617133911.GI28529@csn.ul.ie> (raw)
In-Reply-To: <20090616135301.25248.91276.sendpatchset@lts-notebook>

On Tue, Jun 16, 2009 at 09:53:01AM -0400, Lee Schermerhorn wrote:
> [PATCH 3/5] Use per hstate nodes_allowed to constrain huge page allocation
> 
> Against:  17may09 mmotm
> 
> Select only nodes from the per hstate nodes_allowed mask when
> promoting surplus pages to persistent or when allocating fresh
> huge pages to the pool.
> 
> Note that alloc_buddy_huge_page() still uses task policy to allocate
> surplus huge pages.  This could be changed.
> 
> Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
> 
>  mm/hugetlb.c |   23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> Index: linux-2.6.30-rc8-mmotm-090603-1633/mm/hugetlb.c
> ===================================================================
> --- linux-2.6.30-rc8-mmotm-090603-1633.orig/mm/hugetlb.c	2009-06-04 12:59:32.000000000 -0400
> +++ linux-2.6.30-rc8-mmotm-090603-1633/mm/hugetlb.c	2009-06-04 12:59:33.000000000 -0400
> @@ -637,9 +637,9 @@ static struct page *alloc_fresh_huge_pag
>  static int hstate_next_node(struct hstate *h)
>  {
>  	int next_nid;
> -	next_nid = next_node(h->hugetlb_next_nid, node_online_map);
> +	next_nid = next_node(h->hugetlb_next_nid, *h->nodes_allowed);
>  	if (next_nid == MAX_NUMNODES)
> -		next_nid = first_node(node_online_map);
> +		next_nid = first_node(*h->nodes_allowed);
>  	h->hugetlb_next_nid = next_nid;
>  	return next_nid;
>  }
> @@ -652,6 +652,11 @@ static int alloc_fresh_huge_page(struct 
>  	int ret = 0;
>  
>  	start_nid = h->hugetlb_next_nid;
> +	/*
> +	 * we may have allocated with a different nodes_allowed previously
> +	 */
> +	if (!node_isset(start_nid, *h->nodes_allowed))
> +		start_nid = hstate_next_node(h);
>  
>  	do {
>  		page = alloc_fresh_huge_page_node(h, h->hugetlb_next_nid);
> @@ -1169,20 +1174,28 @@ static inline void try_to_free_low(struc
>  
>  /*
>   * Increment or decrement surplus_huge_pages.  Keep node-specific counters
> - * balanced by operating on them in a round-robin fashion.
> + * balanced by operating on them in a round-robin fashion.  Use nodes_allowed
> + * mask when decreasing suplus pages as we're "promoting" them to persistent.

s/suplus/surplus/

> + * Use node_online_map for increment surplus pages as we're demoting previously
> + * persistent huge pages.
> + * Called holding the hugetlb_lock.
>   * Returns 1 if an adjustment was made.
>   */
>  static int adjust_pool_surplus(struct hstate *h, int delta)
>  {
> +	nodemask_t *nodemask = &node_online_map;
>  	static int prev_nid;
>  	int nid = prev_nid;
>  	int ret = 0;
>  
>  	VM_BUG_ON(delta != -1 && delta != 1);
> +	if (delta < 0)
> +		nodemask = h->nodes_allowed;
> +

Please spell out why nodes_allowed is only used when decreasing the surplus
count.

>  	do {
> -		nid = next_node(nid, node_online_map);
> +		nid = next_node(nid, *nodemask);
>  		if (nid == MAX_NUMNODES)
> -			nid = first_node(node_online_map);
> +			nid = first_node(*nodemask);
>  
>  		/* To shrink on this node, there must be a surplus page */
>  		if (delta < 0 && !h->surplus_huge_pages_node[nid])
> 

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

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

  reply	other threads:[~2009-06-17 13:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16 13:52 [PATCH 0/5] Huge Pages Nodes Allowed Lee Schermerhorn
2009-06-16 13:52 ` [PATCH 1/5] Free huge pages round robin to balance across nodes Lee Schermerhorn
2009-06-17 13:18   ` Mel Gorman
2009-06-17 17:16     ` Lee Schermerhorn
2009-06-18 19:08       ` David Rientjes
2009-06-16 13:52 ` [PATCH 2/5] Add nodes_allowed members to hugepages hstate struct Lee Schermerhorn
2009-06-17 13:35   ` Mel Gorman
2009-06-17 17:38     ` Lee Schermerhorn
2009-06-18  9:17       ` Mel Gorman
2009-06-16 13:53 ` [PATCH 3/5] Use per hstate nodes_allowed to constrain huge page allocation Lee Schermerhorn
2009-06-17 13:39   ` Mel Gorman [this message]
2009-06-17 17:47     ` Lee Schermerhorn
2009-06-18  9:18       ` Mel Gorman
2009-06-16 13:53 ` [PATCH 4/5] Add sysctl for default hstate nodes_allowed Lee Schermerhorn
2009-06-17 13:41   ` Mel Gorman
2009-06-17 17:52     ` Lee Schermerhorn
2009-06-18  9:19       ` Mel Gorman
2009-06-16 13:53 ` [PATCH 5/5] Update huge pages kernel documentation Lee Schermerhorn
2009-06-18 18:49   ` David Rientjes
2009-06-18 19:06     ` Lee Schermerhorn
2009-06-17 13:02 ` [PATCH 0/5] Huge Pages Nodes Allowed Mel Gorman
2009-06-17 17:15   ` Lee Schermerhorn
2009-06-18  9:33     ` Mel Gorman
2009-06-18 14:46       ` Lee Schermerhorn
2009-06-18 15:00         ` Mel Gorman
2009-06-18 19:08     ` David Rientjes
2009-06-24  7:11       ` David Rientjes
2009-06-24 11:25         ` Lee Schermerhorn
2009-06-24 22:26           ` David Rientjes
2009-06-25  2:14             ` Lee Schermerhorn
2009-06-25 19:22               ` David Rientjes

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=20090617133911.GI28529@csn.ul.ie \
    --to=mel@csn.ul.ie \
    --cc=agl@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=eric.whitney@hp.com \
    --cc=lee.schermerhorn@hp.com \
    --cc=linux-mm@kvack.org \
    --cc=nacc@us.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).