linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Davidlohr Bueso <dave@stgolabs.net>,
	Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCH V2 1/4] hugetlbfs: add minimum size tracking fields to subpool structure
Date: Wed, 18 Mar 2015 14:25:58 -0700	[thread overview]
Message-ID: <20150318142558.d2958fbb7f8b083c00c40c0d@linux-foundation.org> (raw)
In-Reply-To: <1ef964ec5febb254dbee28604481c6768e018268.1426549010.git.mike.kravetz@oracle.com>

On Mon, 16 Mar 2015 16:53:26 -0700 Mike Kravetz <mike.kravetz@oracle.com> wrote:

> Add a field to the subpool structure to indicate the minimimum
> number of huge pages to always be used by this subpool.  This
> minimum count includes allocated pages as well as reserved pages.
> If the minimum number of pages for the subpool have not been
> allocated, pages are reserved up to this minimum.  An additional
> field (rsv_hpages) is used to track the number of pages reserved
> to meet this minimum size.  The hstate pointer in the subpool
> is convenient to have when reserving and unreserving the pages.
> 
> ...
>
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -23,6 +23,8 @@ struct hugepage_subpool {
>  	spinlock_t lock;
>  	long count;
>  	long max_hpages, used_hpages;
> +	struct hstate *hstate;
> +	long min_hpages, rsv_hpages;
>  };

Let's leave room for the descriptive comments which aren't there.

--- a/include/linux/hugetlb.h~hugetlbfs-add-minimum-size-tracking-fields-to-subpool-structure-fix
+++ a/include/linux/hugetlb.h
@@ -22,9 +22,11 @@ struct mmu_gather;
 struct hugepage_subpool {
 	spinlock_t lock;
 	long count;
-	long max_hpages, used_hpages;
+	long max_hpagesl
+	long used_hpages;
 	struct hstate *hstate;
-	long min_hpages, rsv_hpages;
+	long min_hpages;
+	long rsv_hpages;
 };
 
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -85,6 +85,9 @@ struct hugepage_subpool *hugepage_new_subpool(long nr_blocks)
>  	spool->count = 1;
>  	spool->max_hpages = nr_blocks;
>  	spool->used_hpages = 0;
> +	spool->hstate = NULL;
> +	spool->min_hpages = 0;
> +	spool->rsv_hpages = 0;

Four strikes and you're out!

--- a/mm/hugetlb.c~hugetlbfs-add-minimum-size-tracking-fields-to-subpool-structure-fix
+++ a/mm/hugetlb.c
@@ -77,17 +77,13 @@ struct hugepage_subpool *hugepage_new_su
 {
 	struct hugepage_subpool *spool;
 
-	spool = kmalloc(sizeof(*spool), GFP_KERNEL);
+	spool = kzalloc(sizeof(*spool), GFP_KERNEL);
 	if (!spool)
 		return NULL;
 
 	spin_lock_init(&spool->lock);
 	spool->count = 1;
 	spool->max_hpages = nr_blocks;
-	spool->used_hpages = 0;
-	spool->hstate = NULL;
-	spool->min_hpages = 0;
-	spool->rsv_hpages = 0;
 
 	return spool;
 }
_

--
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:[~2015-03-18 21:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 23:53 [PATCH V2 0/4] hugetlbfs: add min_size filesystem mount option Mike Kravetz
2015-03-16 23:53 ` [PATCH V2 1/4] hugetlbfs: add minimum size tracking fields to subpool structure Mike Kravetz
2015-03-18 21:25   ` Andrew Morton [this message]
2015-03-16 23:53 ` [PATCH V2 2/4] hugetlbfs: add minimum size accounting to subpools Mike Kravetz
2015-03-18 21:43   ` Andrew Morton
2015-03-16 23:53 ` [PATCH V2 3/4] hugetlbfs: accept subpool min_size mount option and setup accordingly Mike Kravetz
2015-03-18 21:40   ` Andrew Morton
2015-03-19  1:34     ` Mike Kravetz
2015-03-16 23:53 ` [PATCH V2 4/4] hugetlbfs: document min_size mount option Mike Kravetz
2015-03-18 21:41   ` Andrew Morton
2015-03-19  1:51     ` Mike Kravetz
2015-03-19  2:23       ` Andrew Morton
2015-03-20 16:24         ` Mike Kravetz

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=20150318142558.d2958fbb7f8b083c00c40c0d@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=dave@stgolabs.net \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.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