From patchwork Mon Jul 17 14:31:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13315834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E002EB64DC for ; Mon, 17 Jul 2023 14:31:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E4076B0072; Mon, 17 Jul 2023 10:31:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 093FA6B0074; Mon, 17 Jul 2023 10:31:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC4728D0001; Mon, 17 Jul 2023 10:31:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E10416B0072 for ; Mon, 17 Jul 2023 10:31:29 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A0F11120395 for ; Mon, 17 Jul 2023 14:31:29 +0000 (UTC) X-FDA: 81021341898.03.EE8148D Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf20.hostedemail.com (Postfix) with ESMTP id 442E61C0033 for ; Mon, 17 Jul 2023 14:31:23 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689604284; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BP+7rStUqlpLuRykLENwCQmjiIT3a8ADMh8sshpsKms=; b=IrUK1hEJPFGyYBoEFb343ormwFP+iXz/BzMs6mJkOiyJy1MmDwTzUdQXyP5EB3H2/qxyD1 28s/ZIbZ7hcKF8YLslhrWynuaoa8eBULXq+4jPqokuhc3P/wS6TRSNZ/3Da/a+lORfhecb d1WKOYnvn44rKNkX54zA3/jOkyMqy6Y= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689604284; a=rsa-sha256; cv=none; b=3x+EypsW1fkYdIF0aH05oi+x0J49ajgRlLXZwI8DyBCh9AhH7om0VqgLamvWDFXnkCHVe9 r/Jno4wM8wnSgkEVEsfaa3CRP+udD0WGiKxYm4YeqhO+VbUfiuwHUjwrsCwu+T6Y34pRbG WUoeQ2DJmeWiXmHUcbiQi14X8WnI68E= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8D926D75; Mon, 17 Jul 2023 07:32:06 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9E0313F738; Mon, 17 Jul 2023 07:31:21 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Yang Shi , "Huang, Ying" , Zi Yan Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v1 1/3] mm: Allow deferred splitting of arbitrary large anon folios Date: Mon, 17 Jul 2023 15:31:08 +0100 Message-Id: <20230717143110.260162-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717143110.260162-1-ryan.roberts@arm.com> References: <20230717143110.260162-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 442E61C0033 X-Rspam-User: X-Stat-Signature: umunetsyzjmunwnoqtmx9uabu5gqrmws X-Rspamd-Server: rspam01 X-HE-Tag: 1689604283-107920 X-HE-Meta: U2FsdGVkX1+HuT4GAqXEOQz5fPN/ITYkV3tRIbtzHo2jt+hgJZpqa+XNDkLlViAM/sLM6z2IJ91bY7DtvIoxuNX2zJwqdjplUr/8Or/GkcX/zt8ghjtCk4+L1UZUPrb2CBKSt03+GfgLgAHJiF2upucF28PwqJBCqzecE/L5xVyDp3cY1ZHYUazIpYMbjK/O9hdJjzDMikdWWiTR1gWA/YOR7hWcpC+QKG07ZmGargFoQqpuQu1FeERbYfVHMHrAtCQA3ePI5fRO11fHsO4NUK/5YkiIX1jsFSg/NWssZBzqm2dL9vD561OaEPGCKma7U5ZDJ850DjMxziFOfpc7YWV7GeTEhWkEx/ro0lB70huKpNBK8hN6csTWHvBLq7rCzrYJSGca3PsOWFR62Irmvc0HoBZ/yOtpLpF50w1RddyM2tamf4/yl+GSj4VLKq2fxx1CUztr/Ot3hAoGSNW7gSCk/miIcx5TnnUImqmSklw0LtLBoaHFO2vKp9xExPq3ax/nqvIX9/zUNBF6cMTjLcaiAawkxD77YSJF73bWQ94ufvGEJ5qDaYepmAeoXqs9jEBIhpDDoMAzcec+PBc4s3EeCWHnFc2bb2Ae7DlrJRjabqlvPrK/ZlgH5QP1iE1Fxe+beZTKSB//5MjTcWjEDN6qxY0Kr73g76sp56B/hA+aLbYHDS5vCArJuPTuJmiK60ia3w69DpBqYl4KQIzpV5af2klM+HRqrenzxghJXFq2Gdo8aJsPN/6xWI+yVbPa7vm2K3AgoBNfVGnEAcHwDwe23S3KAyodAgJU3CZmUqoT4V9nfis8jmH6FPjT7WjXqpgk2aktIm+AZXXe7PhI5r5HmhGm4biLM89yyOoQhsEze6nb1i5UEd+GPWhc2jmUoo8VafTkZAClO4ApyeWHliM0/PB0eV3aa+c3uug4yDNj8P2CFvavrJw+MFw19AbI1mBybXyolhPxCcUGoh0 Io8tfiLn vfrxbzMjE5CdKnxA2VLixhCC2GlWnGrMFHy/TKR/NrnSrIHns8jot2QTlRWkdr6FCilD+eACYPbtnmWZROrUSR5JYdZqfxLhUO/sRvVndfbSr7eibgWmWFPJCMQGiRb41r+ZNcDUhr1Dis4EhMFNOwpx3/RLRoAGJrk/n1EGAmnMuxNDlj8FwRWx9p6+aPzKTfZr3tlZazHENMUc= 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: In preparation for the introduction of large folios for anonymous memory, we would like to be able to split them when they have unmapped subpages, in order to free those unused pages under memory pressure. So remove the artificial requirement that the large folio needed to be at least PMD-sized. Signed-off-by: Ryan Roberts Reviewed-by: Yu Zhao Reviewed-by: Yin Fengwei Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/rmap.c b/mm/rmap.c index 0c0d8857dfce..2baf57d65c23 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1430,7 +1430,7 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma, * page of the folio is unmapped and at least one page * is still mapped. */ - if (folio_test_pmd_mappable(folio) && folio_test_anon(folio)) + if (folio_test_large(folio) && folio_test_anon(folio)) if (!compound || nr < nr_pmdmapped) deferred_split_folio(folio); }