#define dcache_dirty_cpu(page) \
(((page)->flags >> 24) & (NR_CPUS - 1UL))
-static __inline__ void set_dcache_dirty(struct page *page)
+static __inline__ void set_dcache_dirty(struct page *page, int this_cpu)
{
- unsigned long mask = smp_processor_id();
+ unsigned long mask = this_cpu;
unsigned long non_cpu_bits = ~((NR_CPUS - 1UL) << 24UL);
mask = (mask << 24) | (1UL << PG_dcache_dirty);
__asm__ __volatile__("1:\n\t"
(page = pfn_to_page(pfn), page_mapping(page)) &&
((pg_flags = page->flags) & (1UL << PG_dcache_dirty))) {
int cpu = ((pg_flags >> 24) & (NR_CPUS - 1UL));
+ int this_cpu = get_cpu();
/* This is just to optimize away some function calls
* in the SMP case.
*/
- if (cpu == smp_processor_id())
+ if (cpu == this_cpu)
flush_dcache_page_impl(page);
else
smp_flush_dcache_page_impl(page, cpu);
clear_dcache_dirty_cpu(page, cpu);
+
+ put_cpu();
}
if (get_thread_fault_code())
__update_mmu_cache(vma->vm_mm->context & TAG_CONTEXT_BITS,
struct address_space *mapping = page_mapping(page);
int dirty = test_bit(PG_dcache_dirty, &page->flags);
int dirty_cpu = dcache_dirty_cpu(page);
+ int this_cpu = get_cpu();
if (mapping && !mapping_mapped(mapping)) {
if (dirty) {
- if (dirty_cpu == smp_processor_id())
- return;
+ if (dirty_cpu == this_cpu)
+ goto out;
smp_flush_dcache_page_impl(page, dirty_cpu);
}
- set_dcache_dirty(page);
+ set_dcache_dirty(page, this_cpu);
} else {
/* We could delay the flush for the !page_mapping
* case too. But that case is for exec env/arg
*/
flush_dcache_page_impl(page);
}
+
+out:
+ put_cpu();
}
/* When shared+writable mmaps of files go away, we lose all dirty
* prom_set_traptable() call, and OBP is allocating a scratchpad
* for saving client program register state etc.
*/
-void __init sort_memlist(struct linux_mlist_p1275 *thislist)
+static void __init sort_memlist(struct linux_mlist_p1275 *thislist)
{
int swapi = 0;
int i, mitr;