diff options
author | Ralph Campbell <rcampbell@nvidia.com> | 2018-04-10 16:29:27 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-04-11 10:28:31 -0700 |
commit | 07707125aec6a7529900616ba491210ec3d85fc6 (patch) | |
tree | 777a5ed9de0032b24838eda766d6520c81ccf207 /mm/khugepaged.c | |
parent | bc8755ba66325cb5874eef81d935e91c331d0b1d (diff) | |
download | linux-stable-07707125aec6a7529900616ba491210ec3d85fc6.tar.gz linux-stable-07707125aec6a7529900616ba491210ec3d85fc6.tar.bz2 linux-stable-07707125aec6a7529900616ba491210ec3d85fc6.zip |
mm/migrate: properly preserve write attribute in special migrate entry
Use of pte_write(pte) is only valid for present pte, the common code
which set the migration entry can be reach for both valid present pte
and special swap entry (for device memory). Fix the code to use the
mpfn value which properly handle both cases.
On x86 this did not have any bad side effect because pte write bit is
below PAGE_BIT_GLOBAL and thus special swap entry have it set to 0 which
in turn means we were always creating read only special migration entry.
So once migration did finish we always write protected the CPU page
table entry (moreover this is only an issue when migrating from device
memory to system memory). End effect is that CPU write access would
fault again and restore write permission.
This behaviour isn't too bad; it just burns CPU cycles by forcing CPU to
take a second fault on write access. ie, double faulting the same
address. There is no corruption or incorrect states (it behaves as a
COWed page from a fork with a mapcount of 1).
Link: http://lkml.kernel.org/r/20180402023506.12180-1-jglisse@redhat.com
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/khugepaged.c')
0 files changed, 0 insertions, 0 deletions