Commit 20aaffd6 authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds

[PATCH] x86_64: pageattr use single list

Use page->lru.next to implement the singly linked list of pages rather than
the struct deferred_page which needs to be allocated and freed for each
page.
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Acked-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 84d1c054
...@@ -77,26 +77,12 @@ static inline void flush_map(unsigned long address) ...@@ -77,26 +77,12 @@ static inline void flush_map(unsigned long address)
on_each_cpu(flush_kernel_map, (void *)address, 1, 1); on_each_cpu(flush_kernel_map, (void *)address, 1, 1);
} }
struct deferred_page { static struct page *deferred_pages; /* protected by init_mm.mmap_sem */
struct deferred_page *next;
struct page *fpage; static inline void save_page(struct page *fpage)
unsigned long address;
};
static struct deferred_page *df_list; /* protected by init_mm.mmap_sem */
static inline void save_page(unsigned long address, struct page *fpage)
{ {
struct deferred_page *df; fpage->lru.next = (struct list_head *)deferred_pages;
df = kmalloc(sizeof(struct deferred_page), GFP_KERNEL); deferred_pages = fpage;
if (!df) {
flush_map(address);
__free_page(fpage);
} else {
df->next = df_list;
df->fpage = fpage;
df->address = address;
df_list = df;
}
} }
/* /*
...@@ -163,7 +149,7 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot, ...@@ -163,7 +149,7 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot,
switch (page_count(kpte_page)) { switch (page_count(kpte_page)) {
case 1: case 1:
save_page(address, kpte_page); save_page(kpte_page);
revert_page(address, ref_prot); revert_page(address, ref_prot);
break; break;
case 0: case 0:
...@@ -220,17 +206,17 @@ int change_page_attr(struct page *page, int numpages, pgprot_t prot) ...@@ -220,17 +206,17 @@ int change_page_attr(struct page *page, int numpages, pgprot_t prot)
void global_flush_tlb(void) void global_flush_tlb(void)
{ {
struct deferred_page *df, *next_df; struct page *dpage;
down_read(&init_mm.mmap_sem); down_read(&init_mm.mmap_sem);
df = xchg(&df_list, NULL); dpage = xchg(&deferred_pages, NULL);
up_read(&init_mm.mmap_sem); up_read(&init_mm.mmap_sem);
flush_map((df && !df->next) ? df->address : 0);
for (; df; df = next_df) { flush_map((dpage && !dpage->lru.next) ? (unsigned long)page_address(dpage) : 0);
next_df = df->next; while (dpage) {
if (df->fpage) struct page *tmp = dpage;
__free_page(df->fpage); dpage = (struct page *)dpage->lru.next;
kfree(df); __free_page(tmp);
} }
} }
......
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