mm, thp: Do not make page table dirty unconditionally in touch_p[mu]d()
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Mon, 27 Nov 2017 03:21:25 +0000 (06:21 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 3 Dec 2017 19:41:55 +0000 (19:41 +0000)
commit74bfea42060cf263ba3ec9406eb041a52390e437
treee2006af0340a49bb84c0dfa9670832934e4f1041
parentdb57f6e1c41dde1f4f88008321b8c6f874bb79df
mm, thp: Do not make page table dirty unconditionally in touch_p[mu]d()

Currently, we unconditionally make page table dirty in touch_pmd().
It may result in false-positive can_follow_write_pmd().

We may avoid the situation, if we would only make the page table entry
dirty if caller asks for write access -- FOLL_WRITE.

The patch also changes touch_pud() in the same way.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[carnil: backport for 4.9:
 - Adjust context
 - Drop specific part for PUD-sized transparent hugepages. Support
   for PUD-sized transparent hugepages was added in v4.11-rc1
]

Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name mm-thp-Do-not-make-page-table-dirty-unconditionally-.patch
mm/huge_memory.c