From patchwork Fri Mar 17 10:58:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13178891 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5552DC76196 for ; Fri, 17 Mar 2023 11:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ihRwMoeJD+kqcDY7BIUNVjIbu9JGZ3Gs0djN2KasyoA=; b=iIGC0sHI20nrwQ hE95nO60SxWgtBx8brMwiWojTx9aTpnsjgpGdoJVaw0Fp8vQEbRV+kMs7nVk9ZdfRUqa5dcfbo1Ab ioEl+Z6VQa9RdtsIPNJwgwCA2rGbJKctv1CegCXiWyhhca99/1/e1FcpCNsLb130q0GYsIppSzdte u4NzL+nuhA1dIyfxyakg1x201K3MZ+orfCM1XLrU9d2g2//ykL0yf95P5lr8yK5K7FJyeMJG0N4cF fZafOBsFZK4pEgNT8UbgJZC94o93cLC+Nddem6RcLZzip3UUKUnfdf7SZ76cN5XfGQz5ASlKTjUxB b+BS/PPRDf4x+MyB2/Ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pd7nA-001yBX-23; Fri, 17 Mar 2023 10:58:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pd7n3-001y7I-0p for linux-arm-kernel@lists.infradead.org; Fri, 17 Mar 2023 10:58:31 +0000 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 043051A2D; Fri, 17 Mar 2023 03:59:12 -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 3E3FA3F885; Fri, 17 Mar 2023 03:58:27 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , "Matthew Wilcox (Oracle)" , "Yin, Fengwei" , Yu Zhao Cc: Ryan Roberts , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 6/6] WORKAROUND: Don't split large folios on madvise Date: Fri, 17 Mar 2023 10:58:02 +0000 Message-Id: <20230317105802.2634004-7-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317105802.2634004-1-ryan.roberts@arm.com> References: <20230317105802.2634004-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230317_035829_368365_86FFD4A9 X-CRM114-Status: UNSURE ( 8.44 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Ryan Roberts --- mm/madvise.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.25.1 diff --git a/mm/madvise.c b/mm/madvise.c index 340125d08c03..8fb84da744e1 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -447,6 +447,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, * are sure it's worth. Split it if we are only owner. */ if (folio_test_large(folio)) { +#if 0 if (folio_mapcount(folio) != 1) break; if (pageout_anon_only_filter && !folio_test_anon(folio)) @@ -469,6 +470,9 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, pte--; addr -= PAGE_SIZE; continue; +#else + break; +#endif } /* @@ -664,6 +668,7 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, * deactivate all pages. */ if (folio_test_large(folio)) { +#if 0 if (folio_mapcount(folio) != 1) goto out; folio_get(folio); @@ -684,6 +689,9 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, pte--; addr -= PAGE_SIZE; continue; +#else + goto out; +#endif } if (folio_test_swapcache(folio) || folio_test_dirty(folio)) {