From patchwork Wed Nov 22 16:29:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13465120 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 C940DC61D9B for ; Wed, 22 Nov 2023 16:30:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DF8D8D0037; Wed, 22 Nov 2023 11:30:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 48F0D8D0008; Wed, 22 Nov 2023 11:30:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 357368D0037; Wed, 22 Nov 2023 11:30:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 22AFA8D0008 for ; Wed, 22 Nov 2023 11:30:13 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EC7CE160FE4 for ; Wed, 22 Nov 2023 16:30:12 +0000 (UTC) X-FDA: 81486127464.22.0E272E7 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf27.hostedemail.com (Postfix) with ESMTP id B973440021 for ; Wed, 22 Nov 2023 16:30:09 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700670609; 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=uLiZitmjG+3foZ1+dsOMU1U8TEvwumUeFwfgKAb7Uhk=; b=CMTyM6JbwUUeZwraVDKtdx3ILxhdvLFjBXLTZMBv+JVEydP+qjJs9q1fJAcJrPRaG80uEq bnywIMVtM3/dqiym1sp2owWRyo7smusPZy9rGpmMWICRfg2LC8Yu7QqJjfmYmk4Pnz/gNr sn1Hn6JwmPghLHVJydiZLJoKNjx+Uyo= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf27.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700670609; a=rsa-sha256; cv=none; b=pK0m3QkcofEBvLv9Dzr/5F4eV/nZX2Qcnu1x/6OfVkt2PjVyA5tWi487uQTqf6SVasHi1l 0H9p4BWYRCToqTbfg7dtoLwW0TD3/GJkRWDxOHSor8CWi9kT/IXdPV5PAQMGNbL+8/t99Z Ypr+fBzwRCvQbqiClFyjB8RT3OtpepQ= 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 75A2E1595; Wed, 22 Nov 2023 08:30:55 -0800 (PST) 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 085443F73F; Wed, 22 Nov 2023 08:30:05 -0800 (PST) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama , "Kirill A. Shutemov" , John Hubbard , David Rientjes , Vlastimil Babka , Hugh Dickins , Kefeng Wang Cc: Ryan Roberts , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH v7 01/10] mm: Allow deferred splitting of arbitrary anon large folios Date: Wed, 22 Nov 2023 16:29:41 +0000 Message-Id: <20231122162950.3854897-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231122162950.3854897-1-ryan.roberts@arm.com> References: <20231122162950.3854897-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B973440021 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: mdarrnn91n9x788a8ssb47teymkoxbj3 X-HE-Tag: 1700670609-877150 X-HE-Meta: U2FsdGVkX1+f7IBgpDNlt/iGxq9GcewzfIboeh80ZhveAmejIHb6Vh1728OOaxxUSdNhZBgWzxHrL03neS38S30pC+THcyeK6CtFVkkTqhEa9+Ul/t2QsZMQ5tjdLUVoyWBHbr8YVQ+91E57/kENcFFqz1vQmVWck39T+mevqJxwJOYvakl6ADtURU9OTxFcXyzU1sCv6DvX+pM0OYvDPQT8PSxGFFjDrrTGsoVggc9NEdpllT40qILdp3bfCTlC3AAPNF81F5IyqpakNfSG57TT/5XC5o8yBk9wl6TtRSOn0ra1bmPjrJrXKzrfB9WC3sfNs8+w6XLmbKTvmy5yZjYFLpDxM3GczhDfHVWccsY841ZVhuEuptqv6JWM7g2jir0HwE0e5Amw3HjWtFuTd93fBKMXfd+ZDQjyEdd0C6LFZoyS1mzWz2aQYnJK3hrWigNhLtYXv9US3u5z61FaeFj6/btR56j+esOeTaJgfkp09XlXqj5QBX5wqnASP28donLfkXdeY6xdFbC4CAPbc0nUsWaQYWtPuPzsrzWIcADncBn2paldzme4IRvSd2tSygtryoYbU005I9nT2Pav6FWgpmozD0bjTZlKAM14KID8JZipTR2zDLrL6DO4At9UIPOgXRbUrsHa2ZLkxwZRmCuX1QDC+dSsM9ta0KZ1M/jbjXnc0AzxEx+COcQ8XFpfdUNR3de9bdZ1rofBUeRl9s8AYFgJUy9Qifis8i7ZGN+RlDIK0uSUoHkjifYpMsgymefSpUwDbkBh50lenMOzXLNWGAPXoXJRd4tSgJZ+TXgyCn9nHaajn398RnlJUTgqAbqQ63napQXr3XfxJFvp9eZgejnmivM8Hx4XvymXkLebWLI9oh85sRwQRjL2EBRMWGAf2Fd9CSYm8pcB+vGsTFZ+7U5R1Tm/xET0cV3CkV7MNE9Hgi8Iw9WZhoUJ4go9/il6wjM7JOoluAuwrym m37VHPsO ckeEKHewYTjWYsnDCmG94ucOGxIQ6kfx3K80GRZmaLPgIpYKvvOQCGBLUFHl+/PLQv5WIgL3NJ2VxYL08GnM1rl9AajPpLJtUyi+pz4r7g9mXxZeRORWVxVK+jpWFCe5nzIBc/qFCv0hVLvpRn3Q0/6b12l8XURCtk7YkjfJ365C/1yM/YVHqB5+sP6P6eBgeyd4wv5F+Q7PdOhanOO73qMWUU6qloPTlHUDVghqivYeTJ1J3pxJP+slV2MnwmVBMLCbF7cN5p3qoUjUGE+qEcuiri5tEe6ZwmGlZSodC63zZiymIpcEbHTJDrnf9KONfB1V6d+i3yxUz5md1ExrDIj0AjaWsEg0JUlYc 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: List-Subscribe: List-Unsubscribe: In preparation for the introduction of anonymous small-sized THP, 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. Reviewed-by: Yu Zhao Reviewed-by: Yin Fengwei Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand Signed-off-by: Ryan Roberts Reviewed-by: Barry Song --- mm/rmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/mm/rmap.c b/mm/rmap.c index 7a27a2b41802..49e4d86a4f70 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1488,11 +1488,11 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma, __lruvec_stat_mod_folio(folio, idx, -nr); /* - * Queue anon THP for deferred split if at least one + * Queue anon large folio for deferred split if at least one * 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); }