hugetlb.c (a482289d46587ffcda4c85aab109fb74910d7a48) hugetlb.c (7835e98b2e3c66dba79cb0ff8ebb90a2fe030c29)
1/*
2 * Generic hugetlb support.
3 * (C) William Irwin, April 2004
4 */
5#include <linux/gfp.h>
6#include <linux/list.h>
7#include <linux/init.h>
8#include <linux/module.h>

--- 4 unchanged lines hidden (view full) ---

13#include <linux/pagemap.h>
14#include <linux/mempolicy.h>
15#include <linux/cpuset.h>
16
17#include <asm/page.h>
18#include <asm/pgtable.h>
19
20#include <linux/hugetlb.h>
1/*
2 * Generic hugetlb support.
3 * (C) William Irwin, April 2004
4 */
5#include <linux/gfp.h>
6#include <linux/list.h>
7#include <linux/init.h>
8#include <linux/module.h>

--- 4 unchanged lines hidden (view full) ---

13#include <linux/pagemap.h>
14#include <linux/mempolicy.h>
15#include <linux/cpuset.h>
16
17#include <asm/page.h>
18#include <asm/pgtable.h>
19
20#include <linux/hugetlb.h>
21#include "internal.h"
21
22const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
23static unsigned long nr_huge_pages, free_huge_pages;
24unsigned long max_huge_pages;
25static struct list_head hugepage_freelists[MAX_NUMNODES];
26static unsigned int nr_huge_pages_node[MAX_NUMNODES];
27static unsigned int free_huge_pages_node[MAX_NUMNODES];
28

--- 72 unchanged lines hidden (view full) ---

101
102 spin_lock(&hugetlb_lock);
103 page = dequeue_huge_page(vma, addr);
104 if (!page) {
105 spin_unlock(&hugetlb_lock);
106 return NULL;
107 }
108 spin_unlock(&hugetlb_lock);
22
23const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
24static unsigned long nr_huge_pages, free_huge_pages;
25unsigned long max_huge_pages;
26static struct list_head hugepage_freelists[MAX_NUMNODES];
27static unsigned int nr_huge_pages_node[MAX_NUMNODES];
28static unsigned int free_huge_pages_node[MAX_NUMNODES];
29

--- 72 unchanged lines hidden (view full) ---

102
103 spin_lock(&hugetlb_lock);
104 page = dequeue_huge_page(vma, addr);
105 if (!page) {
106 spin_unlock(&hugetlb_lock);
107 return NULL;
108 }
109 spin_unlock(&hugetlb_lock);
109 set_page_count(page, 1);
110 set_page_refcounted(page);
110 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
111 clear_user_highpage(&page[i], addr);
112 return page;
113}
114
115static int __init hugetlb_init(void)
116{
117 unsigned long i;

--- 29 unchanged lines hidden (view full) ---

147 nr_huge_pages--;
148 nr_huge_pages_node[page_zone(page)->zone_pgdat->node_id]--;
149 for (i = 0; i < (HPAGE_SIZE / PAGE_SIZE); i++) {
150 page[i].flags &= ~(1 << PG_locked | 1 << PG_error | 1 << PG_referenced |
151 1 << PG_dirty | 1 << PG_active | 1 << PG_reserved |
152 1 << PG_private | 1<< PG_writeback);
153 }
154 page[1].lru.next = NULL;
111 for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
112 clear_user_highpage(&page[i], addr);
113 return page;
114}
115
116static int __init hugetlb_init(void)
117{
118 unsigned long i;

--- 29 unchanged lines hidden (view full) ---

148 nr_huge_pages--;
149 nr_huge_pages_node[page_zone(page)->zone_pgdat->node_id]--;
150 for (i = 0; i < (HPAGE_SIZE / PAGE_SIZE); i++) {
151 page[i].flags &= ~(1 << PG_locked | 1 << PG_error | 1 << PG_referenced |
152 1 << PG_dirty | 1 << PG_active | 1 << PG_reserved |
153 1 << PG_private | 1<< PG_writeback);
154 }
155 page[1].lru.next = NULL;
155 set_page_count(page, 1);
156 set_page_refcounted(page);
156 __free_pages(page, HUGETLB_PAGE_ORDER);
157}
158
159#ifdef CONFIG_HIGHMEM
160static void try_to_free_low(unsigned long count)
161{
162 int i, nid;
163 for (i = 0; i < MAX_NUMNODES; ++i) {

--- 403 unchanged lines hidden ---
157 __free_pages(page, HUGETLB_PAGE_ORDER);
158}
159
160#ifdef CONFIG_HIGHMEM
161static void try_to_free_low(unsigned long count)
162{
163 int i, nid;
164 for (i = 0; i < MAX_NUMNODES; ++i) {

--- 403 unchanged lines hidden ---