From: Mel Gorman <mel@csn.ul.ie>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org, pj@sgi.com, linux-mm@kvack.org,
nickpiggin@yahoo.com.au
Subject: Re: [PATCH] [3/18] Convert /proc output code over to report multiple hstates
Date: Tue, 18 Mar 2008 12:28:29 +0000 [thread overview]
Message-ID: <20080318122829.GC23866@csn.ul.ie> (raw)
In-Reply-To: <20080317015816.D915C1B41E0@basil.firstfloor.org>
On (17/03/08 02:58), Andi Kleen didst pronounce:
> I chose to just report the numbers in a row, in the hope
> to minimze breakage of existing software. The "compat" page size
> is always the first number.
>
Glancing through the libhugetlbfs code, it appears to take the first
value after Hugepagesize: as the "huge pagesize" so I suspect you're
safe there at least FWIW.
> Signed-off-by: Andi Kleen <ak@suse.de>
>
> ---
> mm/hugetlb.c | 59 +++++++++++++++++++++++++++++++++++++++--------------------
> 1 file changed, 39 insertions(+), 20 deletions(-)
>
> Index: linux/mm/hugetlb.c
> ===================================================================
> --- linux.orig/mm/hugetlb.c
> +++ linux/mm/hugetlb.c
> @@ -683,37 +683,56 @@ int hugetlb_overcommit_handler(struct ct
>
> #endif /* CONFIG_SYSCTL */
>
> +static int dump_field(char *buf, unsigned field)
> +{
> + int n = 0;
> + struct hstate *h;
> + for_each_hstate (h)
> + n += sprintf(buf + n, " %5lu", *(unsigned long *)((char *)h + field));
> + buf[n++] = '\n';
> + return n;
> +}
> +
> int hugetlb_report_meminfo(char *buf)
> {
> - struct hstate *h = &global_hstate;
> - return sprintf(buf,
> - "HugePages_Total: %5lu\n"
> - "HugePages_Free: %5lu\n"
> - "HugePages_Rsvd: %5lu\n"
> - "HugePages_Surp: %5lu\n"
> - "Hugepagesize: %5lu kB\n",
> - h->nr_huge_pages,
> - h->free_huge_pages,
> - h->resv_huge_pages,
> - h->surplus_huge_pages,
> - 1UL << (huge_page_order(h) + PAGE_SHIFT - 10));
> + struct hstate *h;
> + int n = 0;
> + n += sprintf(buf + 0, "HugePages_Total:");
> + n += dump_field(buf + n, offsetof(struct hstate, nr_huge_pages));
> + n += sprintf(buf + n, "HugePages_Free: ");
> + n += dump_field(buf + n, offsetof(struct hstate, free_huge_pages));
> + n += sprintf(buf + n, "HugePages_Rsvd: ");
> + n += dump_field(buf + n, offsetof(struct hstate, resv_huge_pages));
> + n += sprintf(buf + n, "HugePages_Surp: ");
> + n += dump_field(buf + n, offsetof(struct hstate, surplus_huge_pages));
> + n += sprintf(buf + n, "Hugepagesize: ");
> + for_each_hstate (h)
> + n += sprintf(buf + n, " %5u", huge_page_size(h) / 1024);
> + n += sprintf(buf + n, " kB\n");
> + return n;
> }
>
> int hugetlb_report_node_meminfo(int nid, char *buf)
> {
> - struct hstate *h = &global_hstate;
> - return sprintf(buf,
> - "Node %d HugePages_Total: %5u\n"
> - "Node %d HugePages_Free: %5u\n",
> - nid, h->nr_huge_pages_node[nid],
> - nid, h->free_huge_pages_node[nid]);
> + int n = 0;
> + n += sprintf(buf, "Node %d HugePages_Total:", nid);
> + n += dump_field(buf + n, offsetof(struct hstate,
> + nr_huge_pages_node[nid]));
> + n += sprintf(buf + n , "Node %d HugePages_Free: ", nid);
> + n += dump_field(buf + n, offsetof(struct hstate,
> + free_huge_pages_node[nid]));
> + return n;
> }
>
> /* Return the number pages of memory we physically have, in PAGE_SIZE units. */
> unsigned long hugetlb_total_pages(void)
> {
> - struct hstate *h = &global_hstate;
> - return h->nr_huge_pages * (1 << huge_page_order(h));
> + long x = 0;
> + struct hstate *h;
> + for_each_hstate (h) {
> + x += h->nr_huge_pages * (1 << huge_page_order(h));
> + }
> + return x;
> }
>
> /*
>
> --
> 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>
>
--
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>
next prev parent reply other threads:[~2008-03-18 12:28 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-17 1:58 [PATCH] [0/18] GB pages hugetlb support Andi Kleen
2008-03-17 1:58 ` [PATCH] [1/18] Convert hugeltlb.c over to pass global state around in a structure Andi Kleen
2008-03-17 20:15 ` Adam Litke
2008-03-18 12:05 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [2/18] Add basic support for more than one hstate in hugetlbfs Andi Kleen
2008-03-17 20:22 ` Adam Litke
2008-03-17 20:44 ` Andi Kleen
2008-03-18 12:23 ` Mel Gorman
2008-03-23 10:38 ` KOSAKI Motohiro
2008-03-23 11:28 ` Andi Kleen
2008-03-23 11:30 ` KOSAKI Motohiro
2008-03-17 1:58 ` [PATCH] [3/18] Convert /proc output code over to report multiple hstates Andi Kleen
2008-03-18 12:28 ` Mel Gorman [this message]
2008-03-17 1:58 ` [PATCH] [4/18] Add basic support for more than one hstate in hugetlbfs Andi Kleen
2008-03-17 8:09 ` Paul Jackson
2008-03-17 8:15 ` Andi Kleen
2008-03-17 20:28 ` Adam Litke
2008-03-18 14:11 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [5/18] Expand the hugetlbfs sysctls to handle arrays for all hstates Andi Kleen
2008-03-18 14:34 ` Mel Gorman
2008-03-18 16:49 ` Andi Kleen
2008-03-18 17:01 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [6/18] Add support to have individual hstates for each hugetlbfs mount Andi Kleen
2008-03-18 14:10 ` Adam Litke
2008-03-18 15:02 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [7/18] Abstract out the NUMA node round robin code into a separate function Andi Kleen
2008-03-18 15:42 ` Mel Gorman
2008-03-18 15:47 ` Andi Kleen
2008-03-18 16:04 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [8/18] Add a __alloc_bootmem_node_nopanic Andi Kleen
2008-03-18 15:54 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [9/18] Export prep_compound_page to the hugetlb allocator Andi Kleen
2008-03-17 1:58 ` [PATCH] [10/18] Factor out new huge page preparation code into separate function Andi Kleen
2008-03-17 20:31 ` Adam Litke
2008-03-18 16:02 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [11/18] Fix alignment bug in bootmem allocator Andi Kleen
2008-03-17 2:19 ` Yinghai Lu
2008-03-17 7:02 ` Andi Kleen
2008-03-17 7:17 ` Yinghai Lu
2008-03-17 7:31 ` Yinghai Lu
2008-03-17 7:41 ` Andi Kleen
2008-03-17 7:53 ` Yinghai Lu
2008-03-17 8:10 ` Yinghai Lu
2008-03-17 8:17 ` Andi Kleen
2008-03-17 8:56 ` Andi Kleen
2008-03-17 18:52 ` Yinghai Lu
2008-03-17 21:27 ` Yinghai Lu
2008-03-18 2:06 ` Yinghai Lu
2008-03-18 16:18 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [12/18] Add support to allocate hugetlb pages that are larger than MAX_ORDER Andi Kleen
2008-03-18 16:27 ` Mel Gorman
2008-04-09 16:05 ` Andrew Hastings
2008-04-09 17:56 ` Andi Kleen
2008-03-17 1:58 ` [PATCH] [13/18] Add support to allocate hugepages of different size with hugepages= Andi Kleen
2008-03-18 16:32 ` Mel Gorman
2008-03-18 16:45 ` Andi Kleen
2008-03-18 16:46 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [14/18] Clean up hugetlb boot time printk Andi Kleen
2008-03-18 16:37 ` Mel Gorman
2008-03-17 1:58 ` [PATCH] [15/18] Add support to x86-64 to allocate and lookup GB pages in hugetlb Andi Kleen
2008-03-17 1:58 ` [PATCH] [16/18] Add huge pud support to hugetlbfs Andi Kleen
2008-03-17 1:58 ` [PATCH] [17/18] Add huge pud support to mm/memory.c Andi Kleen
2008-03-17 1:58 ` [PATCH] [18/18] Implement hugepagesz= option for x86-64 Andi Kleen
2008-03-17 9:29 ` Paul Jackson
2008-03-17 9:59 ` Andi Kleen
2008-03-17 10:02 ` Paul Jackson
2008-03-17 3:11 ` [PATCH] [0/18] GB pages hugetlb support Paul Jackson
2008-03-17 7:00 ` Andi Kleen
2008-03-17 7:00 ` Paul Jackson
2008-03-17 7:29 ` Andi Kleen
2008-03-17 5:35 ` Paul Jackson
2008-03-17 6:58 ` Andi Kleen
2008-03-17 9:26 ` Paul Jackson
2008-03-17 15:05 ` Adam Litke
2008-03-17 15:33 ` Andi Kleen
2008-03-17 15:59 ` Adam Litke
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=20080318122829.GC23866@csn.ul.ie \
--to=mel@csn.ul.ie \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
--cc=pj@sgi.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).