diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2017-04-13 14:56:20 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-16 10:33:50 +0100 |
commit | 47c53ccca4a0984d45b4157447b8eeca47d9a51f (patch) | |
tree | a442e154492f1310edbab38d15054af4a8b2db1a /Kbuild | |
parent | d4443b53732e5e98220ec8777d11e3c9eb87f5fd (diff) | |
download | linux-stable-47c53ccca4a0984d45b4157447b8eeca47d9a51f.tar.gz linux-stable-47c53ccca4a0984d45b4157447b8eeca47d9a51f.tar.bz2 linux-stable-47c53ccca4a0984d45b4157447b8eeca47d9a51f.zip |
thp: fix MADV_DONTNEED vs. numa balancing race
commit ced108037c2aa542b3ed8b7afd1576064ad1362a upstream.
In case prot_numa, we are under down_read(mmap_sem). It's critical to
not clear pmd intermittently to avoid race with MADV_DONTNEED which is
also under down_read(mmap_sem):
CPU0: CPU1:
change_huge_pmd(prot_numa=1)
pmdp_huge_get_and_clear_notify()
madvise_dontneed()
zap_pmd_range()
pmd_trans_huge(*pmd) == 0 (without ptl)
// skip the pmd
set_pmd_at();
// pmd is re-established
The race makes MADV_DONTNEED miss the huge pmd and don't clear it
which may break userspace.
Found by code analysis, never saw triggered.
Link: http://lkml.kernel.org/r/20170302151034.27829-3-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[jwang: adjust context for 4.4]
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Kbuild')
0 files changed, 0 insertions, 0 deletions