linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Adam Litke <agl@us.ibm.com>
To: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: wli@holomorphy.com, Lee.Schermerhorn@hp.com, clameter@sgi.com,
	pj@sgi.com, akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [RFC][PATCH] hugetlb: fix pool shrinking while in restricted cpuset
Date: Tue, 04 Mar 2008 09:02:31 -0600	[thread overview]
Message-ID: <1204642951.14779.47.camel@localhost.localdomain> (raw)
In-Reply-To: <20080304011704.GA13954@us.ibm.com>

On Mon, 2008-03-03 at 17:17 -0800, Nishanth Aravamudan wrote:
> Adam Litke noticed that currently we grow the hugepage pool independent
> of any cpuset the running process may be in, but when shrinking the
> pool, the cpuset is checked. This leads to inconsistency when shrinking
> the pool in a restricted cpuset -- an administrator may have been able
> to grow the pool on a node restricted by a containing cpuset, but they
> cannot shrink it there. There are two options: either prevent growing of
> the pool outside of the cpuset or allow shrinking outside of the cpuset.
> >From previous discussions on linux-mm, /proc/sys/vm/nr_hugepages is an
> administrative interface that should not be restricted by cpusets. So
> allow shrinking the pool by removing pages from nodes outside of
> current's cpuset.
> 
> This is a bugfix and should go into 2.6.25.

Wow Andrew, you beat me...

Acked-by: Adam Litke <agl@us.ibm.com>


> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> Cc: Adam Litke <agl@us.ibm.com>
> Cc: William Irwin <wli@holomorphy.com>
> Cc: Lee Schermerhorn <Lee.Schermerhonr@hp.com>
> Cc: Christoph Lameter <clameter@sgi.com>
> Cc: Paul Jackson <pj@sgi.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 89e6286..61ac37f 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -71,7 +71,25 @@ static void enqueue_huge_page(struct page *page)
>  	free_huge_pages_node[nid]++;
>  }
> 
> -static struct page *dequeue_huge_page(struct vm_area_struct *vma,
> +static struct page *dequeue_huge_page(void)
> +{
> +	int nid;
> +	struct page *page = NULL;
> +
> +	for (nid = 0; nid < MAX_NUMNODES; ++nid) {
> +		if (!list_empty(&hugepage_freelists[nid])) {
> +			page = list_entry(hugepage_freelists[nid].next,
> +					  struct page, lru);
> +			list_del(&page->lru);
> +			free_huge_pages--;
> +			free_huge_pages_node[nid]--;
> +			break;
> +		}
> +	}
> +	return page;
> +}
> +
> +static struct page *dequeue_huge_page_vma(struct vm_area_struct *vma,
>  				unsigned long address)
>  {
>  	int nid;
> @@ -402,7 +420,7 @@ static struct page *alloc_huge_page_shared(struct vm_area_struct *vma,
>  	struct page *page;
> 
>  	spin_lock(&hugetlb_lock);
> -	page = dequeue_huge_page(vma, addr);
> +	page = dequeue_huge_page_vma(vma, addr);
>  	spin_unlock(&hugetlb_lock);
>  	return page ? page : ERR_PTR(-VM_FAULT_OOM);
>  }
> @@ -417,7 +435,7 @@ static struct page *alloc_huge_page_private(struct vm_area_struct *vma,
> 
>  	spin_lock(&hugetlb_lock);
>  	if (free_huge_pages > resv_huge_pages)
> -		page = dequeue_huge_page(vma, addr);
> +		page = dequeue_huge_page_vma(vma, addr);
>  	spin_unlock(&hugetlb_lock);
>  	if (!page) {
>  		page = alloc_buddy_huge_page(vma, addr);
> @@ -570,7 +588,7 @@ static unsigned long set_max_huge_pages(unsigned long count)
>  	min_count = max(count, min_count);
>  	try_to_free_low(min_count);
>  	while (min_count < persistent_huge_pages) {
> -		struct page *page = dequeue_huge_page(NULL, 0);
> +		struct page *page = dequeue_huge_page();
>  		if (!page)
>  			break;
>  		update_and_free_page(page);
> 
-- 
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center

--
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:[~2008-03-04 14:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-04  1:17 [RFC][PATCH] hugetlb: fix pool shrinking while in restricted cpuset Nishanth Aravamudan
2008-03-04 15:02 ` Adam Litke [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=1204642951.14779.47.camel@localhost.localdomain \
    --to=agl@us.ibm.com \
    --cc=Lee.Schermerhorn@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    --cc=nacc@us.ibm.com \
    --cc=pj@sgi.com \
    --cc=wli@holomorphy.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).