From patchwork Mon Jul 12 03:06:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 12370123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77205C07E99 for ; Mon, 12 Jul 2021 04:17:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1F6BE610FB for ; Mon, 12 Jul 2021 04:17:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F6BE610FB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4650C6B0011; Mon, 12 Jul 2021 00:17:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43C0A6B009B; Mon, 12 Jul 2021 00:17:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3042D6B009F; Mon, 12 Jul 2021 00:17:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id 0C93C6B0011 for ; Mon, 12 Jul 2021 00:17:17 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2CA4623116 for ; Mon, 12 Jul 2021 04:17:16 +0000 (UTC) X-FDA: 78352626072.09.9C9814A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id EB50290000A4 for ; Mon, 12 Jul 2021 04:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=FvnKvrUT2fNk7/OyTjb1Ax4qDl3oGlD3/8sIT3O/4a8=; b=fqZKTW6TtdDvbDhqH27ow4lpWv ITL2ujZDrU6THFtBDkEa/65oFbDX+klfUR3YNABj94//fPUtK4/y8J76LdAe3RHEaAwVKNZKb1rYa GSre3ApdeyYv8XxW1k2uMs8Ir7vR1mKagHI6C6s+iLEqQcHR5eV+6ofmV13S1jSMK2JJVYo5x0fe/ lMFLBpSIEH8iverjHjHiyDYH8Iyv/jl/RV9o8enYqkzvVtoHuy65nIj7KSB5/SJHQlsBZY8bRw1I1 HFN7+2CR1LPQN/Gz68QN/CsQ7jxX66B5JM8o2YLKu/jVHjVAfKEMTE2Lg8tNNWzM8wPGb+AchC4dm WV4rimCA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2nMu-00Greh-BD; Mon, 12 Jul 2021 04:16:40 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v13 131/137] mm/vmscan: Free non-shmem THPs without splitting them Date: Mon, 12 Jul 2021 04:06:55 +0100 Message-Id: <20210712030701.4000097-132-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712030701.4000097-1-willy@infradead.org> References: <20210712030701.4000097-1-willy@infradead.org> MIME-Version: 1.0 Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=fqZKTW6T; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Stat-Signature: 4i1aziqcad8y7rndowknjrq1kjnemyu6 X-Rspamd-Queue-Id: EB50290000A4 X-Rspamd-Server: rspam01 X-HE-Tag: 1626063435-404458 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We have to allocate memory in order to split a file-backed page, so it's not a good idea to split them. It also doesn't work for XFS because pages have an extra reference count from page_has_private() and split_huge_page() expects that reference to have already been removed. Unfortunately, we still have to split shmem THPs because we can't handle swapping out an entire THP yet. Signed-off-by: Matthew Wilcox (Oracle) --- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 7a2f25b904d9..8b17e46dbf32 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1470,8 +1470,8 @@ static unsigned int shrink_page_list(struct list_head *page_list, /* Adding to swap updated mapping */ mapping = page_mapping(page); } - } else if (unlikely(PageTransHuge(page))) { - /* Split file THP */ + } else if (PageSwapBacked(page) && PageTransHuge(page)) { + /* Split shmem THP */ if (split_huge_page_to_list(page, page_list)) goto keep_locked; }