linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch 23/26] mm/vmscan.c: support removing arbitrary sized pages from mapping
@ 2019-10-19  3:20 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2019-10-19  3:20 UTC (permalink / raw)
  To: akpm, kirill.shutemov, linux-mm, mm-commits, oleg,
	songliubraving, srikar, torvalds, william.kucharski, willy,
	yang.shi

From: William Kucharski <william.kucharski@oracle.com>
Subject: mm/vmscan.c: support removing arbitrary sized pages from mapping

__remove_mapping() assumes that pages can only be either base pages or
HPAGE_PMD_SIZE.  Ask the page what size it is.

Link: http://lkml.kernel.org/r/20191017164223.2762148-4-songliubraving@fb.com
Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS")
Signed-off-by: William Kucharski <william.kucharski@oracle.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Song Liu <songliubraving@fb.com>
Acked-by: Yang Shi <yang.shi@linux.alibaba.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/vmscan.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/mm/vmscan.c~mm-support-removing-arbitrary-sized-pages-from-mapping
+++ a/mm/vmscan.c
@@ -933,10 +933,7 @@ static int __remove_mapping(struct addre
 	 * Note that if SetPageDirty is always performed via set_page_dirty,
 	 * and thus under the i_pages lock, then this ordering is not required.
 	 */
-	if (unlikely(PageTransHuge(page)) && PageSwapCache(page))
-		refcount = 1 + HPAGE_PMD_NR;
-	else
-		refcount = 2;
+	refcount = 1 + compound_nr(page);
 	if (!page_ref_freeze(page, refcount))
 		goto cannot_free;
 	/* note: atomic_cmpxchg in page_ref_freeze provides the smp_rmb */
_


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-19  3:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-19  3:20 [patch 23/26] mm/vmscan.c: support removing arbitrary sized pages from mapping akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).