Commit c41bb9c4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] stop using page->list in the hugetlbpage implementations

Switch them over to page.lru
parent 62e52945
...@@ -29,7 +29,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED; ...@@ -29,7 +29,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
static void enqueue_huge_page(struct page *page) static void enqueue_huge_page(struct page *page)
{ {
list_add(&page->list, list_add(&page->lru,
&hugepage_freelists[page_zone(page)->zone_pgdat->node_id]); &hugepage_freelists[page_zone(page)->zone_pgdat->node_id]);
} }
...@@ -44,8 +44,8 @@ static struct page *dequeue_huge_page(void) ...@@ -44,8 +44,8 @@ static struct page *dequeue_huge_page(void)
break; break;
} }
if (nid >= 0 && nid < MAX_NUMNODES && !list_empty(&hugepage_freelists[nid])) { if (nid >= 0 && nid < MAX_NUMNODES && !list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next, struct page, list); page = list_entry(hugepage_freelists[nid].next, struct page, lru);
list_del(&page->list); list_del(&page->lru);
} }
return page; return page;
} }
...@@ -280,7 +280,7 @@ static void free_huge_page(struct page *page) ...@@ -280,7 +280,7 @@ static void free_huge_page(struct page *page)
BUG_ON(page_count(page)); BUG_ON(page_count(page));
BUG_ON(page->mapping); BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list); INIT_LIST_HEAD(&page->lru);
spin_lock(&htlbpage_lock); spin_lock(&htlbpage_lock);
enqueue_huge_page(page); enqueue_huge_page(page);
...@@ -409,19 +409,19 @@ static int try_to_free_low(int count) ...@@ -409,19 +409,19 @@ static int try_to_free_low(int count)
/* all lowmem is on node 0 */ /* all lowmem is on node 0 */
list_for_each(p, &hugepage_freelists[0]) { list_for_each(p, &hugepage_freelists[0]) {
if (map) { if (map) {
list_del(&map->list); list_del(&map->lru);
update_and_free_page(map); update_and_free_page(map);
htlbpagemem--; htlbpagemem--;
map = NULL; map = NULL;
if (++count == 0) if (++count == 0)
break; break;
} }
page = list_entry(p, struct page, list); page = list_entry(p, struct page, lru);
if (!PageHighMem(page)) if (!PageHighMem(page))
map = page; map = page;
} }
if (map) { if (map) {
list_del(&map->list); list_del(&map->lru);
update_and_free_page(map); update_and_free_page(map);
htlbpagemem--; htlbpagemem--;
count++; count++;
......
...@@ -32,7 +32,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED; ...@@ -32,7 +32,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
static void enqueue_huge_page(struct page *page) static void enqueue_huge_page(struct page *page)
{ {
list_add(&page->list, list_add(&page->lru,
&hugepage_freelists[page_zone(page)->zone_pgdat->node_id]); &hugepage_freelists[page_zone(page)->zone_pgdat->node_id]);
} }
...@@ -48,8 +48,8 @@ static struct page *dequeue_huge_page(void) ...@@ -48,8 +48,8 @@ static struct page *dequeue_huge_page(void)
} }
if (nid >= 0 && nid < MAX_NUMNODES && if (nid >= 0 && nid < MAX_NUMNODES &&
!list_empty(&hugepage_freelists[nid])) { !list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next, struct page, list); page = list_entry(hugepage_freelists[nid].next, struct page, lru);
list_del(&page->list); list_del(&page->lru);
} }
return page; return page;
} }
...@@ -248,7 +248,7 @@ void free_huge_page(struct page *page) ...@@ -248,7 +248,7 @@ void free_huge_page(struct page *page)
BUG_ON(page_count(page)); BUG_ON(page_count(page));
BUG_ON(page->mapping); BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list); INIT_LIST_HEAD(&page->lru);
spin_lock(&htlbpage_lock); spin_lock(&htlbpage_lock);
enqueue_huge_page(page); enqueue_huge_page(page);
...@@ -449,19 +449,19 @@ int try_to_free_low(int count) ...@@ -449,19 +449,19 @@ int try_to_free_low(int count)
spin_lock(&htlbpage_lock); spin_lock(&htlbpage_lock);
list_for_each(p, &hugepage_freelists[0]) { list_for_each(p, &hugepage_freelists[0]) {
if (map) { if (map) {
list_del(&map->list); list_del(&map->lru);
update_and_free_page(map); update_and_free_page(map);
htlbpagemem--; htlbpagemem--;
map = NULL; map = NULL;
if (++count == 0) if (++count == 0)
break; break;
} }
page = list_entry(p, struct page, list); page = list_entry(p, struct page, lru);
if (!PageHighMem(page)) if (!PageHighMem(page))
map = page; map = page;
} }
if (map) { if (map) {
list_del(&map->list); list_del(&map->lru);
update_and_free_page(map); update_and_free_page(map);
htlbpagemem--; htlbpagemem--;
count++; count++;
......
...@@ -40,7 +40,7 @@ static struct list_head hugepage_freelists[MAX_NUMNODES]; ...@@ -40,7 +40,7 @@ static struct list_head hugepage_freelists[MAX_NUMNODES];
static void enqueue_huge_page(struct page *page) static void enqueue_huge_page(struct page *page)
{ {
list_add(&page->list, list_add(&page->lru,
&hugepage_freelists[page_zone(page)->zone_pgdat->node_id]); &hugepage_freelists[page_zone(page)->zone_pgdat->node_id]);
} }
...@@ -63,8 +63,8 @@ static struct page *dequeue_huge_page(void) ...@@ -63,8 +63,8 @@ static struct page *dequeue_huge_page(void)
} }
if (!list_empty(&hugepage_freelists[nid])) { if (!list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next, struct page, list); page = list_entry(hugepage_freelists[nid].next, struct page, lru);
list_del(&page->list); list_del(&page->lru);
} }
if (largepage_roundrobin) if (largepage_roundrobin)
...@@ -452,7 +452,7 @@ static void free_huge_page(struct page *page) ...@@ -452,7 +452,7 @@ static void free_huge_page(struct page *page)
BUG_ON(page_count(page)); BUG_ON(page_count(page));
BUG_ON(page->mapping); BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list); INIT_LIST_HEAD(&page->lru);
spin_lock(&htlbpage_lock); spin_lock(&htlbpage_lock);
enqueue_huge_page(page); enqueue_huge_page(page);
......
...@@ -33,7 +33,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED; ...@@ -33,7 +33,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
static void enqueue_huge_page(struct page *page) static void enqueue_huge_page(struct page *page)
{ {
list_add(&page->list, list_add(&page->lru,
&hugepage_freelists[page_zone(page)->zone_pgdat->node_id]); &hugepage_freelists[page_zone(page)->zone_pgdat->node_id]);
} }
...@@ -51,7 +51,7 @@ static struct page *dequeue_huge_page(void) ...@@ -51,7 +51,7 @@ static struct page *dequeue_huge_page(void)
!list_empty(&hugepage_freelists[nid])) { !list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next, page = list_entry(hugepage_freelists[nid].next,
struct page, list); struct page, list);
list_del(&page->list); list_del(&page->lru);
} }
return page; return page;
} }
...@@ -254,8 +254,6 @@ static void free_huge_page(struct page *page) ...@@ -254,8 +254,6 @@ static void free_huge_page(struct page *page)
BUG_ON(page_count(page)); BUG_ON(page_count(page));
BUG_ON(page->mapping); BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list);
spin_lock(&htlbpage_lock); spin_lock(&htlbpage_lock);
enqueue_huge_page(page); enqueue_huge_page(page);
htlbpagemem++; htlbpagemem++;
...@@ -388,7 +386,7 @@ static int try_to_free_low(int count) ...@@ -388,7 +386,7 @@ static int try_to_free_low(int count)
/* all lowmem is on node 0 */ /* all lowmem is on node 0 */
list_for_each(p, &hugepage_freelists[0]) { list_for_each(p, &hugepage_freelists[0]) {
if (map) { if (map) {
list_del(&map->list); list_del(&map->lru);
update_and_free_page(map); update_and_free_page(map);
htlbpagemem--; htlbpagemem--;
map = NULL; map = NULL;
...@@ -400,7 +398,7 @@ static int try_to_free_low(int count) ...@@ -400,7 +398,7 @@ static int try_to_free_low(int count)
map = page; map = page;
} }
if (map) { if (map) {
list_del(&map->list); list_del(&map->lru);
update_and_free_page(map); update_and_free_page(map);
htlbpagemem--; htlbpagemem--;
count++; count++;
......
...@@ -29,7 +29,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED; ...@@ -29,7 +29,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
static void enqueue_huge_page(struct page *page) static void enqueue_huge_page(struct page *page)
{ {
list_add(&page->list, list_add(&page->lru,
&hugepage_freelists[page_zone(page)->zone_pgdat->node_id]); &hugepage_freelists[page_zone(page)->zone_pgdat->node_id]);
} }
...@@ -46,8 +46,8 @@ static struct page *dequeue_huge_page(void) ...@@ -46,8 +46,8 @@ static struct page *dequeue_huge_page(void)
if (nid >= 0 && nid < MAX_NUMNODES && if (nid >= 0 && nid < MAX_NUMNODES &&
!list_empty(&hugepage_freelists[nid])) { !list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next, page = list_entry(hugepage_freelists[nid].next,
struct page, list); struct page, lru);
list_del(&page->list); list_del(&page->lru);
} }
return page; return page;
} }
...@@ -250,7 +250,7 @@ static void free_huge_page(struct page *page) ...@@ -250,7 +250,7 @@ static void free_huge_page(struct page *page)
BUG_ON(page_count(page)); BUG_ON(page_count(page));
BUG_ON(page->mapping); BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list); INIT_LIST_HEAD(&page->lru);
spin_lock(&htlbpage_lock); spin_lock(&htlbpage_lock);
enqueue_huge_page(page); enqueue_huge_page(page);
...@@ -384,19 +384,19 @@ static int try_to_free_low(int count) ...@@ -384,19 +384,19 @@ static int try_to_free_low(int count)
/* all lowmem is on node 0 */ /* all lowmem is on node 0 */
list_for_each(p, &hugepage_freelists[0]) { list_for_each(p, &hugepage_freelists[0]) {
if (map) { if (map) {
list_del(&map->list); list_del(&map->lru);
update_and_free_page(map); update_and_free_page(map);
htlbpagemem--; htlbpagemem--;
map = NULL; map = NULL;
if (++count == 0) if (++count == 0)
break; break;
} }
page = list_entry(p, struct page, list); page = list_entry(p, struct page, lru);
if (!PageHighMem(page)) if (!PageHighMem(page))
map = page; map = page;
} }
if (map) { if (map) {
list_del(&map->list); list_del(&map->lru);
update_and_free_page(map); update_and_free_page(map);
htlbpagemem--; htlbpagemem--;
count++; count++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment