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;
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]);
}
......@@ -44,8 +44,8 @@ static struct page *dequeue_huge_page(void)
break;
}
if (nid >= 0 && nid < MAX_NUMNODES && !list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next, struct page, list);
list_del(&page->list);
page = list_entry(hugepage_freelists[nid].next, struct page, lru);
list_del(&page->lru);
}
return page;
}
......@@ -280,7 +280,7 @@ static void free_huge_page(struct page *page)
BUG_ON(page_count(page));
BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list);
INIT_LIST_HEAD(&page->lru);
spin_lock(&htlbpage_lock);
enqueue_huge_page(page);
......@@ -409,19 +409,19 @@ static int try_to_free_low(int count)
/* all lowmem is on node 0 */
list_for_each(p, &hugepage_freelists[0]) {
if (map) {
list_del(&map->list);
list_del(&map->lru);
update_and_free_page(map);
htlbpagemem--;
map = NULL;
if (++count == 0)
break;
}
page = list_entry(p, struct page, list);
page = list_entry(p, struct page, lru);
if (!PageHighMem(page))
map = page;
}
if (map) {
list_del(&map->list);
list_del(&map->lru);
update_and_free_page(map);
htlbpagemem--;
count++;
......
......@@ -32,7 +32,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
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]);
}
......@@ -48,8 +48,8 @@ static struct page *dequeue_huge_page(void)
}
if (nid >= 0 && nid < MAX_NUMNODES &&
!list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next, struct page, list);
list_del(&page->list);
page = list_entry(hugepage_freelists[nid].next, struct page, lru);
list_del(&page->lru);
}
return page;
}
......@@ -248,7 +248,7 @@ void free_huge_page(struct page *page)
BUG_ON(page_count(page));
BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list);
INIT_LIST_HEAD(&page->lru);
spin_lock(&htlbpage_lock);
enqueue_huge_page(page);
......@@ -449,19 +449,19 @@ int try_to_free_low(int count)
spin_lock(&htlbpage_lock);
list_for_each(p, &hugepage_freelists[0]) {
if (map) {
list_del(&map->list);
list_del(&map->lru);
update_and_free_page(map);
htlbpagemem--;
map = NULL;
if (++count == 0)
break;
}
page = list_entry(p, struct page, list);
page = list_entry(p, struct page, lru);
if (!PageHighMem(page))
map = page;
}
if (map) {
list_del(&map->list);
list_del(&map->lru);
update_and_free_page(map);
htlbpagemem--;
count++;
......
......@@ -40,7 +40,7 @@ static struct list_head hugepage_freelists[MAX_NUMNODES];
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]);
}
......@@ -63,8 +63,8 @@ static struct page *dequeue_huge_page(void)
}
if (!list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next, struct page, list);
list_del(&page->list);
page = list_entry(hugepage_freelists[nid].next, struct page, lru);
list_del(&page->lru);
}
if (largepage_roundrobin)
......@@ -452,7 +452,7 @@ static void free_huge_page(struct page *page)
BUG_ON(page_count(page));
BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list);
INIT_LIST_HEAD(&page->lru);
spin_lock(&htlbpage_lock);
enqueue_huge_page(page);
......
......@@ -33,7 +33,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
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]);
}
......@@ -51,7 +51,7 @@ static struct page *dequeue_huge_page(void)
!list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next,
struct page, list);
list_del(&page->list);
list_del(&page->lru);
}
return page;
}
......@@ -254,8 +254,6 @@ static void free_huge_page(struct page *page)
BUG_ON(page_count(page));
BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list);
spin_lock(&htlbpage_lock);
enqueue_huge_page(page);
htlbpagemem++;
......@@ -388,7 +386,7 @@ static int try_to_free_low(int count)
/* all lowmem is on node 0 */
list_for_each(p, &hugepage_freelists[0]) {
if (map) {
list_del(&map->list);
list_del(&map->lru);
update_and_free_page(map);
htlbpagemem--;
map = NULL;
......@@ -400,7 +398,7 @@ static int try_to_free_low(int count)
map = page;
}
if (map) {
list_del(&map->list);
list_del(&map->lru);
update_and_free_page(map);
htlbpagemem--;
count++;
......
......@@ -29,7 +29,7 @@ static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
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]);
}
......@@ -46,8 +46,8 @@ static struct page *dequeue_huge_page(void)
if (nid >= 0 && nid < MAX_NUMNODES &&
!list_empty(&hugepage_freelists[nid])) {
page = list_entry(hugepage_freelists[nid].next,
struct page, list);
list_del(&page->list);
struct page, lru);
list_del(&page->lru);
}
return page;
}
......@@ -250,7 +250,7 @@ static void free_huge_page(struct page *page)
BUG_ON(page_count(page));
BUG_ON(page->mapping);
INIT_LIST_HEAD(&page->list);
INIT_LIST_HEAD(&page->lru);
spin_lock(&htlbpage_lock);
enqueue_huge_page(page);
......@@ -384,19 +384,19 @@ static int try_to_free_low(int count)
/* all lowmem is on node 0 */
list_for_each(p, &hugepage_freelists[0]) {
if (map) {
list_del(&map->list);
list_del(&map->lru);
update_and_free_page(map);
htlbpagemem--;
map = NULL;
if (++count == 0)
break;
}
page = list_entry(p, struct page, list);
page = list_entry(p, struct page, lru);
if (!PageHighMem(page))
map = page;
}
if (map) {
list_del(&map->list);
list_del(&map->lru);
update_and_free_page(map);
htlbpagemem--;
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