From patchwork Fri Sep 29 11:44:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13404125 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 AB8D1E810D5 for ; Fri, 29 Sep 2023 11:44:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 203968D00ED; Fri, 29 Sep 2023 07:44:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B4E58D0023; Fri, 29 Sep 2023 07:44:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 006AE8D00ED; Fri, 29 Sep 2023 07:44:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E78CD8D0023 for ; Fri, 29 Sep 2023 07:44:38 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BE18FB463F for ; Fri, 29 Sep 2023 11:44:38 +0000 (UTC) X-FDA: 81289452636.23.658607B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf16.hostedemail.com (Postfix) with ESMTP id 1D81918001D for ; Fri, 29 Sep 2023 11:44:36 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf16.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=1695987877; 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=wW8PmLeN+NODDjeW+k+loXBT9eKUllZt4ss/4twQx6U=; b=DMRf/jz0bmT1zHLc6DbqEzh0iEOYCJ7VMgpn+NGRYOdRB5lHw31DuGArwJXyM8i5JgVVMV 0GFcEDrZW/UBuL6gQ/hYo3d/Qzk3j1kP8/ePQkxtWcMgF6fxyfELBwhDPBwB0K+XZtFnjQ csbtPGAHqavWdxTRGUhREnFN5d3leTk= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf16.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=1695987877; a=rsa-sha256; cv=none; b=OciZf3tIbe59e0YvTASbJgPhLFrtUcWGM6ZHhizbotCN0NU0J9HvWt6pD1Go47n2H+FXNX a3UyyHsP07km7m5F63S6DXx4T6m3m9qniKFqBHa/UaOBHDucZo0FH79khHjvVPjM6ryAgz QgP2InVoegjrSVEfMfdh5GCzo1KwYyU= 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 77FA4DA7; Fri, 29 Sep 2023 04:45:14 -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 94DAD3F59C; Fri, 29 Sep 2023 04:44:33 -0700 (PDT) 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 Cc: Ryan Roberts , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 1/9] mm: Allow deferred splitting of arbitrary anon large folios Date: Fri, 29 Sep 2023 12:44:12 +0100 Message-Id: <20230929114421.3761121-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230929114421.3761121-1-ryan.roberts@arm.com> References: <20230929114421.3761121-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1D81918001D X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: qu4i7wbaseqgj6mqe3f94ewyu4ppjoai X-HE-Tag: 1695987876-873634 X-HE-Meta: U2FsdGVkX1+avFHH2SjvYWvR2b5qJT01UhmeQGI6vBkAFGoz3wHmUhJWqk7XIjH/6tzULlyQ33aSP+D1T9pGqsnz3WPwfdK+LZPPeIaGXAhRMJUP1uhbR/h4VBPQsi1YKiN/4d6MxrEKuk076Z/WmuohEPJZmAVc1W/J6jXiEiBBpH8Nju/Vi7aiqAOhFfAGTW6WT8SYOAeVFs/0Rs4JzD0hvDHndqOIU5Z05gCsnQILcsDdpQ/36h7aSITFyCcSSauPHd/D1hG+lI9QhwC5F+IIqWGUrjL+D0qg+pGLNvFQChSHA3XLhRULiZ23tCebheL+0Jjj+G6Y5c41sxU+3FSuH6Lyco0NY+lQnBAVkf1b0SXrR6O6H9JuSiOeo5YVnNwzoU2GzoUcISBJJV7+WwMEpFiBMTG+w1y9ffynyxcmh08QtPEfAKMOVN8HtKK1PmubfLEOHSAWcIUE5iDrpH+l/Ovlgdq7XbuJQsqqRPg39yn+1PC5UeIt5K6TljdQWiLwqQDEV3JEQx7X3zQdU+3DquMakgipCpIhHigomJlnqfQDs0bd0DLhVbtI5I7lLwoaxq45GCQ0/J6eXYUqJfjp8h5y8mb3EHJQjxKzBflUXy4vvIMUptn+HINUSsP8Hrhhp8CpwRhHBG7JCeUHynXRRxuLGNLy94ctSjwH+kXwqnEBuE+sfmyLQlUDbIIlcFHCthYq7OvAsoWp9gdpnV5RoJPXQZZmhN3oZnyp/hj8OLYQyiTq3GN7aa+hLtVGXelU0VB6v44b45jr9UZD7K+0Zh+SACLOgVau6l6am8+EM5OTWUc7j6rBO9ksC6KOVdQIAvfbfrfBAelWbe3itb5yppKRHOPsSyd3VE2blpA8tJ7TscnONLVoy79TnCGlDSZL9lRi1odGzPuE/1Veq6mxNNQgL+x5vQBTfRpw4AKU9xbgtL5204nf7mfWUfp35EcM1Y7u3N6VbEbSsK2 h9jwIOAj YYDzxN2PDuoboTtRC70nOvASoEuEe2hUSb7cy8q7lrWmGd3S8svQs8crAJrkHfS+oyvXZUxlbjrnD6rS3B8TjKTnYgesMWfFIBxIf2AmlY2zWjozo+TBwGLJ+7bEe6yL4L4MARSSqKzZDeX65nveS8gmDJ+pzgB4rfrZV0WZ5mmw50bylIxdZA2tEP5CMzxRrw5Gdyd1xctZW7T+HieytCkKMPAJCOktQXAtg3tSgNjLecyPdbo7Z8oSM/mMGcB9e/8lEEdxWbdCufHYrWZLWmM+YX1z12R0nIZUDB9UXUicTI5KeLWbtlwPhKmTJq8JeSoOVBzolhyAhOyMoLprcnaY6Yjtc6+nJnNmS 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. Reviewed-by: Yu Zhao Reviewed-by: Yin Fengwei Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand Signed-off-by: Ryan Roberts --- mm/rmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 9f795b93cf40..8600bd029acf 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1446,11 +1446,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); }