summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-03-31 21:51:13 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-03-31 21:51:13 -0800
commitc1c0d51858eefd09a493eed31eab7babcb49e45f (patch)
treea1dc67613d25ebc20e92f690c22a67d3f79bac99 /include/linux
parent112347bb4c455feaa03bfe632b54d5ec5dee9fa7 (diff)
[PATCH] Fix hugetlb-vs-memory overcommit
From: Andy Whitcroft <apw@shadowen.org> Two problems: a) The memory overcommit code fails oto take into account all the pages which are pinned by being reserved for the hugetlbpage pool b) We're performing overcommit accounting and checking on behalf of hugetlbpage vmas. The main thrust is to ensure that VM_ACCOUNT actually only gets set on vma's which are indeed accountable. With that ensured much of the rest comes out in the wash. It also removes the hugetlb memory for the overcommit_memory=2 case.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hugetlb.h5
-rw-r--r--include/linux/mm.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 5075a90bcd65..da3fc826a0de 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -19,6 +19,7 @@ int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
void huge_page_release(struct page *);
int hugetlb_report_meminfo(char *);
int is_hugepage_mem_enough(size_t);
+unsigned long hugetlb_total_pages(void);
struct page *follow_huge_addr(struct mm_struct *mm, struct vm_area_struct *vma,
unsigned long address, int write);
struct vm_area_struct *hugepage_vma(struct mm_struct *mm,
@@ -55,6 +56,10 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
{
return 0;
}
+static inline unsigned long hugetlb_total_pages(void)
+{
+ return 0;
+}
#define follow_hugetlb_page(m,v,p,vs,a,b,i) ({ BUG(); 0; })
#define follow_huge_addr(mm, vma, addr, write) 0
diff --git a/include/linux/mm.h b/include/linux/mm.h
index aaca9bd6ff8a..fbd569b35b4f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -112,6 +112,9 @@ struct vm_area_struct {
#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
+/* It makes sense to apply VM_ACCOUNT to this vma. */
+#define VM_MAYACCT(vma) (!!((vma)->vm_flags & VM_HUGETLB))
+
#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
#endif