mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
hugetlb: multiple hstates for multiple page sizes
Add basic support for more than one hstate in hugetlbfs. This is the key to supporting multiple hugetlbfs page sizes at once. - Rather than a single hstate, we now have an array, with an iterator - default_hstate continues to be the struct hstate which we use by default - Add functions for architectures to register new hstates [akpm@linux-foundation.org: coding-style fixes] Acked-by: Adam Litke <agl@us.ibm.com> Acked-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
a551643895
commit
e5ff215941
3 changed files with 142 additions and 33 deletions
|
@ -36,8 +36,6 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,
|
|||
struct vm_area_struct *vma);
|
||||
void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
|
||||
|
||||
extern unsigned long max_huge_pages;
|
||||
extern unsigned long sysctl_overcommit_huge_pages;
|
||||
extern unsigned long hugepages_treat_as_movable;
|
||||
extern const unsigned long hugetlb_zero, hugetlb_infinity;
|
||||
extern int sysctl_hugetlb_shm_group;
|
||||
|
@ -181,7 +179,17 @@ struct hstate {
|
|||
unsigned int surplus_huge_pages_node[MAX_NUMNODES];
|
||||
};
|
||||
|
||||
extern struct hstate default_hstate;
|
||||
void __init hugetlb_add_hstate(unsigned order);
|
||||
struct hstate *size_to_hstate(unsigned long size);
|
||||
|
||||
#ifndef HUGE_MAX_HSTATE
|
||||
#define HUGE_MAX_HSTATE 1
|
||||
#endif
|
||||
|
||||
extern struct hstate hstates[HUGE_MAX_HSTATE];
|
||||
extern unsigned int default_hstate_idx;
|
||||
|
||||
#define default_hstate (hstates[default_hstate_idx])
|
||||
|
||||
static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
|
||||
{
|
||||
|
@ -230,6 +238,11 @@ static inline unsigned int blocks_per_huge_page(struct hstate *h)
|
|||
|
||||
#include <asm/hugetlb.h>
|
||||
|
||||
static inline struct hstate *page_hstate(struct page *page)
|
||||
{
|
||||
return size_to_hstate(PAGE_SIZE << compound_order(page));
|
||||
}
|
||||
|
||||
#else
|
||||
struct hstate {};
|
||||
#define hstate_file(f) NULL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue