Skip to content

Commit 1ae71d0

Browse files
Liu Ping Fantorvalds
Liu Ping Fan
authored andcommitted
mm: numa: bugfix for LAST_CPUPID_NOT_IN_PAGE_FLAGS
When doing some numa tests on powerpc, I triggered an oops bug. I find it is caused by using page->_last_cpupid. It should be initialized as "-1 & LAST_CPUPID_MASK", but not "-1". Otherwise, in task_numa_fault(), we will miss the checking (last_cpupid == (-1 & LAST_CPUPID_MASK)). And finally cause an oops bug in task_numa_group(), since the online cpu is less than possible cpu. This happen with CONFIG_SPARSE_VMEMMAP disabled Call trace: SMP NR_CPUS=64 NUMA PowerNV Modules linked in: CPU: 24 PID: 804 Comm: systemd-udevd Not tainted3.13.0-rc1+ #32 task: c000001e2746aa80 ti: c000001e32c50000 task.ti:c000001e32c50000 REGS: c000001e32c53510 TRAP: 0300 Not tainted(3.13.0-rc1+) MSR: 9000000000009032 <SF,HV,EE,ME,IR,DR,RI> CR:28024424 XER: 20000000 CFAR: c000000000009324 DAR: 7265717569726857 DSISR:40000000 SOFTE: 1 NIP .task_numa_fault+0x1470/0x2370 LR .task_numa_fault+0x1468/0x2370 Call Trace: .task_numa_fault+0x1468/0x2370 (unreliable) .do_numa_page+0x480/0x4a0 .handle_mm_fault+0x4ec/0xc90 .do_page_fault+0x3a8/0x890 handle_page_fault+0x10/0x30 Instruction dump: 3c82fefb 3884b138 48d9cff1 60000000 48000574 3c62fefb3863af78 3c82fefb 3884b138 48d9cfd5 60000000 e93f0100 <812902e4> 7d2907b45529063e 7d2a07b4 ---[ end trace 15f2510da5ae07cf ]--- Signed-off-by: Liu Ping Fan <[email protected]> Signed-off-by: Aneesh Kumar K.V <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Mel Gorman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent cea8321 commit 1ae71d0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/mm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ static inline bool __cpupid_match_pid(pid_t task_pid, int cpupid)
767767
#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
768768
static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
769769
{
770-
return xchg(&page->_last_cpupid, cpupid);
770+
return xchg(&page->_last_cpupid, cpupid & LAST_CPUPID_MASK);
771771
}
772772

773773
static inline int page_cpupid_last(struct page *page)
@@ -776,7 +776,7 @@ static inline int page_cpupid_last(struct page *page)
776776
}
777777
static inline void page_cpupid_reset_last(struct page *page)
778778
{
779-
page->_last_cpupid = -1;
779+
page->_last_cpupid = -1 & LAST_CPUPID_MASK;
780780
}
781781
#else
782782
static inline int page_cpupid_last(struct page *page)

0 commit comments

Comments
 (0)