From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f175.google.com (mail-ob0-f175.google.com [209.85.214.175]) by kanga.kvack.org (Postfix) with ESMTP id 0AF716B0070 for ; Fri, 27 Feb 2015 18:00:01 -0500 (EST) Received: by mail-ob0-f175.google.com with SMTP id va2so21564335obc.6 for ; Fri, 27 Feb 2015 15:00:00 -0800 (PST) Received: from aserp1040.oracle.com (aserp1040.oracle.com. [141.146.126.69]) by mx.google.com with ESMTPS id kg7si2819107obb.56.2015.02.27.15.00.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 27 Feb 2015 15:00:00 -0800 (PST) From: Mike Kravetz Subject: [RFC 1/3] hugetlbfs: add reserved mount fields to subpool structure Date: Fri, 27 Feb 2015 14:58:10 -0800 Message-Id: <1425077893-18366-3-git-send-email-mike.kravetz@oracle.com> In-Reply-To: <1425077893-18366-1-git-send-email-mike.kravetz@oracle.com> References: <1425077893-18366-1-git-send-email-mike.kravetz@oracle.com> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Nadia Yvette Chambers , Andrew Morton , Davidlohr Bueso , Aneesh Kumar , Joonsoo Kim , Mike Kravetz Add a boolean to the subpool structure to indicate that the pages for subpool have been reserved. The hstate pointer in the subpool is convienient to have when it comes time to unreserve the pages. subool_reserved() is a handy way to check if reserved and take into account a NULL subpool. Signed-off-by: Mike Kravetz --- include/linux/hugetlb.h | 6 ++++++ mm/hugetlb.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 431b7fc..605c648 100644 --- 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; + bool reserved; }; struct resv_map { @@ -38,6 +40,10 @@ extern int hugetlb_max_hstate __read_mostly; #define for_each_hstate(h) \ for ((h) = hstates; (h) < &hstates[hugetlb_max_hstate]; (h)++) +static inline bool subpool_reserved(struct hugepage_subpool *spool) +{ + return spool && spool->reserved; +} struct hugepage_subpool *hugepage_new_subpool(long nr_blocks); void hugepage_put_subpool(struct hugepage_subpool *spool); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 85032de..c6adf65 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -85,6 +85,8 @@ 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->reserved = false; return spool; } -- 2.1.0 -- 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: email@kvack.org