From: Andy Whitcroft <apw@shadowen.org>
To: Anton Blanchard <anton@samba.org>, Andrew Morton <akpm@osdl.org>,
Stephen Smalley <sds@epoch.ncsc.mil>
Cc: Andi Kleen <ak@suse.de>,
raybry@sgi.com, lse-tech@lists.sourceforge.net,
linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org,
"Martin J. Bligh" <mbligh@aracnet.com>
Subject: [PATCH] [5/6] HUGETLB memory commitment
Date: Thu, 25 Mar 2004 17:02:49 +0000 [thread overview]
Message-ID: <18926564.1080234169@42.150.104.212.access.eclipse.net.uk> (raw)
In-Reply-To: <18429360.1080233672@42.150.104.212.access.eclipse.net.uk>
[075-mem_acctdom_hugetlb_arch]
Convert hugetlb to accounting domains (arch)
---
i386/mm/hugetlbpage.c | 16 +++++++++++++---
ia64/mm/hugetlbpage.c | 16 +++++++++++++---
ppc64/mm/hugetlbpage.c | 16 +++++++++++++---
sparc64/mm/hugetlbpage.c | 16 +++++++++++++---
4 files changed, 52 insertions(+), 12 deletions(-)
diff -upN reference/arch/i386/mm/hugetlbpage.c current/arch/i386/mm/hugetlbpage.c
--- reference/arch/i386/mm/hugetlbpage.c 2004-01-09 07:00:02.000000000 +0000
+++ current/arch/i386/mm/hugetlbpage.c 2004-03-25 15:03:27.000000000 +0000
@@ -15,7 +15,7 @@
#include <linux/module.h>
#include <linux/err.h>
#include <linux/sysctl.h>
-#include <asm/mman.h>
+#include <linux/mman.h>
#include <asm/pgalloc.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
@@ -513,13 +513,17 @@ module_init(hugetlb_init);
int hugetlb_report_meminfo(char *buf)
{
+ int committed = atomic_read(&vm_committed_space[VM_AD_HUGETLB]);
+#define K(x) ((x) << (PAGE_SHIFT - 10))
return sprintf(buf,
"HugePages_Total: %5lu\n"
"HugePages_Free: %5lu\n"
- "Hugepagesize: %5lu kB\n",
+ "Hugepagesize: %5lu kB\n"
+ "HugeCommited_AS: %8u kB\n",
htlbzone_pages,
htlbpagemem,
- HPAGE_SIZE/1024);
+ HPAGE_SIZE/1024,
+ K(committed));
}
int is_hugepage_mem_enough(size_t size)
@@ -527,6 +531,12 @@ int is_hugepage_mem_enough(size_t size)
return (size + ~HPAGE_MASK)/HPAGE_SIZE <= htlbpagemem;
}
+/* Return the number pages of memory we physically have, in PAGE_SIZE units. */
+unsigned long hugetlb_total_pages(void)
+{
+ return htlbzone_pages * (HPAGE_SIZE / PAGE_SIZE);
+}
+
/*
* We cannot handle pagefaults against hugetlb pages at all. They cause
* handle_mm_fault() to try to instantiate regular-sized pages in the
diff -upN reference/arch/ia64/mm/hugetlbpage.c current/arch/ia64/mm/hugetlbpage.c
--- reference/arch/ia64/mm/hugetlbpage.c 2004-03-11 20:47:12.000000000 +0000
+++ current/arch/ia64/mm/hugetlbpage.c 2004-03-25 15:03:27.000000000 +0000
@@ -17,7 +17,7 @@
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
-#include <asm/mman.h>
+#include <linux/mman.h>
#include <asm/pgalloc.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
@@ -576,13 +576,17 @@ __initcall(hugetlb_init);
int hugetlb_report_meminfo(char *buf)
{
+ int committed = atomic_read(&vm_committed_space[VM_AD_HUGETLB]);
+#define K(x) ((x) << (PAGE_SHIFT - 10))
return sprintf(buf,
"HugePages_Total: %5lu\n"
"HugePages_Free: %5lu\n"
- "Hugepagesize: %5lu kB\n",
+ "Hugepagesize: %5lu kB\n"
+ "HugeCommited_AS: %8u kB\n",
htlbzone_pages,
htlbpagemem,
- HPAGE_SIZE/1024);
+ HPAGE_SIZE/1024,
+ K(committed));
}
int is_hugepage_mem_enough(size_t size)
@@ -592,6 +596,12 @@ int is_hugepage_mem_enough(size_t size)
return 1;
}
+/* Return the number pages of memory we physically have, in PAGE_SIZE units. */
+unsigned long hugetlb_total_pages(void)
+{
+ return htlbzone_pages * (HPAGE_SIZE / PAGE_SIZE);
+}
+
static struct page *hugetlb_nopage(struct vm_area_struct * area, unsigned long address, int *unused)
{
BUG();
diff -upN reference/arch/ppc64/mm/hugetlbpage.c current/arch/ppc64/mm/hugetlbpage.c
--- reference/arch/ppc64/mm/hugetlbpage.c 2004-03-11 20:47:14.000000000 +0000
+++ current/arch/ppc64/mm/hugetlbpage.c 2004-03-25 15:03:27.000000000 +0000
@@ -17,7 +17,7 @@
#include <linux/module.h>
#include <linux/err.h>
#include <linux/sysctl.h>
-#include <asm/mman.h>
+#include <linux/mman.h>
#include <asm/pgalloc.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
@@ -896,13 +896,17 @@ module_init(hugetlb_init);
int hugetlb_report_meminfo(char *buf)
{
+ int committed = atomic_read(&vm_committed_space[VM_AD_HUGETLB]);
+#define K(x) ((x) << (PAGE_SHIFT - 10))
return sprintf(buf,
"HugePages_Total: %5d\n"
"HugePages_Free: %5d\n"
- "Hugepagesize: %5lu kB\n",
+ "Hugepagesize: %5lu kB\n"
+ "HugeCommited_AS: %8u kB",
htlbpage_total,
htlbpage_free,
- HPAGE_SIZE/1024);
+ HPAGE_SIZE/1024,
+ K(commited));
}
/* This is advisory only, so we can get away with accesing
@@ -912,6 +916,12 @@ int is_hugepage_mem_enough(size_t size)
return (size + ~HPAGE_MASK)/HPAGE_SIZE <= htlbpage_free;
}
+/* Return the number pages of memory we physically have, in PAGE_SIZE units. */
+int hugetlb_total_pages(void)
+{
+ return htlbpage_total * (HPAGE_SIZE / PAGE_SIZE);
+}
+
/*
* We cannot handle pagefaults against hugetlb pages at all. They cause
* handle_mm_fault() to try to instantiate regular-sized pages in the
diff -upN reference/arch/sparc64/mm/hugetlbpage.c current/arch/sparc64/mm/hugetlbpage.c
--- reference/arch/sparc64/mm/hugetlbpage.c 2004-01-09 06:59:45.000000000 +0000
+++ current/arch/sparc64/mm/hugetlbpage.c 2004-03-25 15:03:27.000000000 +0000
@@ -13,8 +13,8 @@
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
+#include <linux/mman.h>
-#include <asm/mman.h>
#include <asm/pgalloc.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
@@ -483,13 +483,17 @@ module_init(hugetlb_init);
int hugetlb_report_meminfo(char *buf)
{
+ int committed = atomic_read(&vm_committed_space[VM_AD_HUGETLB]);
+#define K(x) ((x) << (PAGE_SHIFT - 10))
return sprintf(buf,
"HugePages_Total: %5lu\n"
"HugePages_Free: %5lu\n"
- "Hugepagesize: %5lu kB\n",
+ "Hugepagesize: %5lu kB\n"
+ "HugeCommited_AS: %8u kB\n",
htlbzone_pages,
htlbpagemem,
- HPAGE_SIZE/1024);
+ HPAGE_SIZE/1024,
+ K(committed));
}
int is_hugepage_mem_enough(size_t size)
@@ -497,6 +501,12 @@ int is_hugepage_mem_enough(size_t size)
return (size + ~HPAGE_MASK)/HPAGE_SIZE <= htlbpagemem;
}
+/* Return the number pages of memory we physically have, in PAGE_SIZE units. */
+int hugetlb_total_pages(void)
+{
+ return htlbzone_pages * (HPAGE_SIZE / PAGE_SIZE);
+}
+
/*
* We cannot handle pagefaults against hugetlb pages at all. They cause
* handle_mm_fault() to try to instantiate regular-sized pages in the
next prev parent reply other threads:[~2004-03-25 17:02 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-25 16:54 [PATCH] [0/6] HUGETLB memory commitment Andy Whitcroft
2004-03-25 16:58 ` [PATCH] [1/6] " Andy Whitcroft
2004-03-25 16:59 ` [PATCH] [2/6] " Andy Whitcroft
2004-03-25 17:00 ` [PATCH] [3/6] " Andy Whitcroft
2004-03-25 17:01 ` [PATCH] [4/6] " Andy Whitcroft
2004-03-25 17:02 ` Andy Whitcroft [this message]
2004-03-25 17:03 ` [PATCH] [6/6] " Andy Whitcroft
2004-03-25 21:04 ` [PATCH] [0/6] " Andrew Morton
2004-03-25 23:27 ` Andy Whitcroft
2004-03-25 23:51 ` Andrew Morton
2004-03-25 23:59 ` Andy Whitcroft
2004-03-26 2:01 ` Andy Whitcroft
2004-03-26 0:18 ` Martin J. Bligh
2004-03-28 18:02 ` Ray Bryant
2004-03-28 19:10 ` Martin J. Bligh
2004-03-28 21:32 ` [Lse-tech] " Ray Bryant
2004-03-29 16:50 ` Martin J. Bligh
2004-03-29 12:30 ` Andy Whitcroft
2004-03-26 0:10 ` Keith Owens
2004-03-26 0:22 ` Andrew Morton
2004-03-26 3:41 ` [Lse-tech] " Suparna Bhattacharya
2004-03-26 3:39 ` Keith Owens
2004-03-26 11:45 ` Suparna Bhattacharya
2004-03-29 20:45 ` Chen, Kenneth W
2004-03-29 20:49 ` Chen, Kenneth W
2004-03-30 12:57 ` Andy Whitcroft
2004-03-30 20:04 ` Chen, Kenneth W
2004-03-30 21:48 ` Andy Whitcroft
2004-03-31 1:48 ` Andy Whitcroft
2004-03-31 8:51 ` Chen, Kenneth W
2004-03-31 16:20 ` Andy Whitcroft
2004-04-01 21:15 ` Andy Whitcroft
2004-04-01 22:50 ` Andy Whitcroft
2004-04-01 23:09 ` Chen, Kenneth W
2004-04-03 3:57 ` [PATCH] " Ray Bryant
2004-04-04 3:31 ` Chen, Kenneth W
2004-04-04 22:15 ` Ray Bryant
2004-04-05 15:26 ` [Lse-tech] " Ray Bryant
2004-04-05 17:01 ` Chen, Kenneth W
2004-04-05 18:22 ` Ray Bryant
2004-04-05 23:18 ` Chen, Kenneth W
2004-04-06 1:05 ` Ray Bryant
2004-04-06 16:14 ` Andy Whitcroft
2004-04-06 17:40 ` Chen, Kenneth W
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=18926564.1080234169@42.150.104.212.access.eclipse.net.uk \
--to=apw@shadowen.org \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=anton@samba.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lse-tech@lists.sourceforge.net \
--cc=mbligh@aracnet.com \
--cc=raybry@sgi.com \
--cc=sds@epoch.ncsc.mil \
/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