Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57887
b: refs/heads/master
c: 018d2ad
h: refs/heads/master
i:
  57885: 9e5ccd7
  57883: c797242
  57879: 7f07ea7
  57871: 8005e1a
  57855: 67805f9
v: v3
  • Loading branch information
Andi Kleen authored and Linus Torvalds committed Jun 20, 2007
1 parent d3b89a6 commit d65249b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 55181000cd60334fe920c65ffbcdfe0e3f1de406
refs/heads/master: 018d2ad0cccfa9bb8bee1d160c353e568484a137
30 changes: 18 additions & 12 deletions trunk/arch/i386/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,23 @@ static struct page *split_large_page(unsigned long address, pgprot_t prot,
return base;
}

static void flush_kernel_map(void *arg)
static void cache_flush_page(struct page *p)
{
unsigned long adr = (unsigned long)arg;
unsigned long adr = (unsigned long)page_address(p);
int i;
for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size)
asm volatile("clflush (%0)" :: "r" (adr + i));
}

static void flush_kernel_map(void *arg)
{
struct list_head *lh = (struct list_head *)arg;
struct page *p;

if (adr && cpu_has_clflush) {
int i;
for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size)
asm volatile("clflush (%0)" :: "r" (adr + i));
/* High level code is not ready for clflush yet */
if (0 && cpu_has_clflush) {
list_for_each_entry (p, lh, lru)
cache_flush_page(p);
} else if (boot_cpu_data.x86_model >= 4)
wbinvd();

Expand Down Expand Up @@ -181,9 +190,9 @@ __change_page_attr(struct page *page, pgprot_t prot)
return 0;
}

static inline void flush_map(void *adr)
static inline void flush_map(struct list_head *l)
{
on_each_cpu(flush_kernel_map, adr, 1, 1);
on_each_cpu(flush_kernel_map, l, 1, 1);
}

/*
Expand Down Expand Up @@ -225,11 +234,8 @@ void global_flush_tlb(void)
spin_lock_irq(&cpa_lock);
list_replace_init(&df_list, &l);
spin_unlock_irq(&cpa_lock);
if (!cpu_has_clflush)
flush_map(NULL);
flush_map(&l);
list_for_each_entry_safe(pg, next, &l, lru) {
if (cpu_has_clflush)
flush_map(page_address(pg));
__free_page(pg);
}
}
Expand Down
7 changes: 4 additions & 3 deletions trunk/arch/x86_64/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ static void flush_kernel_map(void *arg)
struct page *pg;

/* When clflush is available always use it because it is
much cheaper than WBINVD */
if (!cpu_has_clflush)
much cheaper than WBINVD. Disable clflush for now because
the high level code is not ready yet */
if (1 || !cpu_has_clflush)
asm volatile("wbinvd" ::: "memory");
list_for_each_entry(pg, l, lru) {
else list_for_each_entry(pg, l, lru) {
void *adr = page_address(pg);
if (cpu_has_clflush)
cache_flush_page(adr);
Expand Down

0 comments on commit d65249b

Please sign in to comment.