forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork1
Commitced1080
thp: fix MADV_DONTNEED vs. numa balancing race
In case prot_numa, we are under down_read(mmap_sem). It's critical tonot clear pmd intermittently to avoid race with MADV_DONTNEED which isalso 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-establishedThe race makes MADV_DONTNEED miss the huge pmd and don't clear itwhich may break userspace.Found by code analysis, never saw triggered.Link:http://lkml.kernel.org/r/20170302151034.27829-3-kirill.shutemov@linux.intel.comSigned-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>1 parent0a85e51 commitced1080
1 file changed
+33
-1
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1746 | 1746 |
| |
1747 | 1747 |
| |
1748 | 1748 |
| |
1749 |
| - | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
1750 | 1782 |
| |
1751 | 1783 |
| |
1752 | 1784 |
| |
|
0 commit comments
Comments
(0)