1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sun, 24 Jan 2016 01:03:51 +0100
3 Subject: [PATCH] MIPS: fix cache flushing for highmem pages
5 Most cache flush ops were no-op for highmem pages. This led to nasty
6 segfaults and (in the case of page_address(page) == NULL) kernel
9 Fix this by always flushing highmem pages using kmap/kunmap_atomic
10 around the actual cache flush. This might be a bit inefficient, but at
13 Signed-off-by: Felix Fietkau <nbd@nbd.name>
16 --- a/arch/mips/mm/cache.c
17 +++ b/arch/mips/mm/cache.c
18 @@ -111,6 +111,13 @@ void __flush_anon_page(struct page *page
20 unsigned long addr = (unsigned long) page_address(page);
22 + if (PageHighMem(page)) {
23 + addr = (unsigned long)kmap_atomic(page);
24 + flush_data_cache_page(addr);
25 + __kunmap_atomic((void *)addr);
29 if (pages_do_alias(addr, vmaddr)) {
30 if (page_mapped(page) && !Page_dcache_dirty(page)) {