mm/thp: flush file for !is_shmem PageDirty() case in collapse_file()
authorSong Liu <songliubraving@fb.com>
Sun, 1 Dec 2019 01:57:19 +0000 (17:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 1 Dec 2019 20:59:09 +0000 (12:59 -0800)
commit75f360696ce9d8ec8b253452b23b3e24c0689b4b
tree9e2c219ca30d2b4ef0c6f426e653518bb77422f1
parentf1fe80d4ae3396cf3665bd6dc77f4004c1c2e9f8
mm/thp: flush file for !is_shmem PageDirty() case in collapse_file()

For non-shmem file THPs, khugepaged only collapses read only .text
mapping (VM_DENYWRITE).  These pages should not be dirty except the case
where the file hasn't been flushed since first write.

Call filemap_flush() in collapse_file() to accelerate the write back in
such cases.

Link: http://lkml.kernel.org/r/20191106060930.2571389-3-songliubraving@fb.com
Signed-off-by: Song Liu <songliubraving@fb.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: William Kucharski <william.kucharski@oracle.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/khugepaged.c