Message ID | 20241226132259.7975-1-hailong.liu@oppo.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 C5B0FE77188 for <linux-mm@archiver.kernel.org>; Thu, 26 Dec 2024 13:23:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCA7F6B007B; Thu, 26 Dec 2024 08:23:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D7ABC6B0083; Thu, 26 Dec 2024 08:23:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1AA96B0085; Thu, 26 Dec 2024 08:23:19 -0500 (EST) 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 A2E746B007B for <linux-mm@kvack.org>; Thu, 26 Dec 2024 08:23:19 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 57F908102C for <linux-mm@kvack.org>; Thu, 26 Dec 2024 13:23:19 +0000 (UTC) X-FDA: 82937173578.20.CC2813F Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2042.outbound.protection.outlook.com [40.107.117.42]) by imf13.hostedemail.com (Postfix) with ESMTP id A05042000E for <linux-mm@kvack.org>; Thu, 26 Dec 2024 13:22:35 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oppo.com header.s=selector1 header.b=ncPmJtSq; spf=pass (imf13.hostedemail.com: domain of hailong.liu@oppo.com designates 40.107.117.42 as permitted sender) smtp.mailfrom=hailong.liu@oppo.com; dmarc=pass (policy=quarantine) header.from=oppo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735219377; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=4z9TptuwOQsDNmfFmpVozoNCWJs9pU/Qbnj3y1Ep0Is=; b=dlpEls82+cCkx7x+AejH+c9trNWVfLPSJw0+v2K2zMPwsW8dmzBWhAtXsZEBWeefOJZLx+ /gSiFSAY1ol0fdqsBaVFYUpykNqZavv9fOl5DC/f09qeI2NB7RwadzYJaFSHR+OaOnlH0U yYcRz0Ly3nxDqY8zQZa9dee3LsU8ZVM= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1735219377; a=rsa-sha256; cv=pass; b=Xh17yokUNsILULaeMYik663Z9EknDdZDX1dGkWmA4BqsTAD3MXu5O4OdKv/xRs5AJcb+Eb YEJXV96zVssr9UxeoMozfGTQBnfyJrumKfkTrO7wAx3SMeocVEvhwcII6EkKOgWFpFuVgB QswYoeuRQRGuRwWLuFBarClbmxcb0qs= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oppo.com header.s=selector1 header.b=ncPmJtSq; spf=pass (imf13.hostedemail.com: domain of hailong.liu@oppo.com designates 40.107.117.42 as permitted sender) smtp.mailfrom=hailong.liu@oppo.com; dmarc=pass (policy=quarantine) header.from=oppo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fPGRzjfGHJ8+Y6npR8gJbC3THDQoC6URSOPXfAcDjSmxtusU6P+R+6EsTaTL0sS6RtiDVaACoBZJIcy3mXQhHpDBM9rzp2f+0Tu6496pBm9wAQ7kSazpZT60zncSscjtfT0lep3PoNKRMcHyCcznTdRZhBFgneYBN8hi1PU0lcmjaRDES3kPs5owlKCPvo+fT0RHSfBi/FucvxplzqFcdw5QM9tHG1CjWr/gpt47MYIYHtPorkQVImJbDa+Dg6lFIVioG0QVQTCtFODPPYap7L95TNTdetI6I3Z+W336szY+zxfZGTGaFcMyl6s/sDc8lH0OjMszFhwWKxaGZIHH/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4z9TptuwOQsDNmfFmpVozoNCWJs9pU/Qbnj3y1Ep0Is=; b=s9V5p8sn3JL4UerrQooIHPruw3sVX/QgNfcRMY+UiAEYlSKIGl0q8E/MLyXD2YR7V9kpjX3sJkYQ0ztoWFfH19hj5BhUYSznZ10QuwS7PP70NjR6Lf/l1PK1NnkF/Sh6vNykH7s/aDt7KHll6cLTruNlTJ1zRB7eE3Vpn87izs1EChHxyqRxiSpOlsIC6OT0harRs9Bx4JlegXAAzL03s+FBm17eZ0vrLuzVDLJE8UEWnIrHuvXrZ1NiJ3iwmlYk3+9ItyBWvIc4L0fW4RitVioBzFu4dMJ69pG8liI/f7fesXLV13PZZM39vJvovwCpVq0Hw0TulGCjlyM/Mk3BtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 58.252.5.68) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=oppo.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=oppo.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4z9TptuwOQsDNmfFmpVozoNCWJs9pU/Qbnj3y1Ep0Is=; b=ncPmJtSqHwBwhEuPTHAi3G0sG4F8jaXjtTTDAshooXbby1WGgbCMS97nzoDt1ie7W1dyRnScd3mTPjAB5tEAKXwFXhPAyInz6Z++BPLg3m/Y/oIMemlEamj1Y/6jpnKUclDaZPVRj6KlxZCF5eM+lMo/UHoPVbrIWUxvD+nGCa8= Received: from SI2PR06CA0008.apcprd06.prod.outlook.com (2603:1096:4:186::23) by KL1PR02MB7311.apcprd02.prod.outlook.com (2603:1096:820:11b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.14; Thu, 26 Dec 2024 13:23:10 +0000 Received: from SG2PEPF000B66CD.apcprd03.prod.outlook.com (2603:1096:4:186:cafe::23) by SI2PR06CA0008.outlook.office365.com (2603:1096:4:186::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.14 via Frontend Transport; Thu, 26 Dec 2024 13:23:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 58.252.5.68) smtp.mailfrom=oppo.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=oppo.com; Received-SPF: Pass (protection.outlook.com: domain of oppo.com designates 58.252.5.68 as permitted sender) receiver=protection.outlook.com; client-ip=58.252.5.68; helo=mail.oppo.com; pr=C Received: from mail.oppo.com (58.252.5.68) by SG2PEPF000B66CD.mail.protection.outlook.com (10.167.240.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8293.12 via Frontend Transport; Thu, 26 Dec 2024 13:23:09 +0000 Received: from PH80250894.adc.com (172.16.40.118) by mailappw31.adc.com (172.16.56.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 26 Dec 2024 21:23:09 +0800 From: hailong <hailong.liu@oppo.com> To: <akpm@linux-foundation.org>, <minchan@kernel.org> CC: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <chao@kernel.org>, <surenb@google.com>, <21cnbao@gmail.com>, Hailong Liu <hailong.liu@oppo.com> Subject: [RFC PATCH] mm/madvise: enable files from read-only block for MADV_PAGEOUT Date: Thu, 26 Dec 2024 21:22:59 +0800 Message-ID: <20241226132259.7975-1-hailong.liu@oppo.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.16.40.118] X-ClientProxiedBy: mailappw30.adc.com (172.16.56.197) To mailappw31.adc.com (172.16.56.198) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PEPF000B66CD:EE_|KL1PR02MB7311:EE_ X-MS-Office365-Filtering-Correlation-Id: ba01107f-e77b-4480-dd8a-08dd25b07132 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: 1nhWuQBFT3VL0ytfMlsSjaNJvq42mSoIs+ff4Bvu8/0bBkhWlYXG2LnE5lv+h3edS/20txORnlt2noIHl7xksmm1OTZYhjnDXsQ3pxqJS5MiitGLAxrH7vvj88dr125cGvKA1AJhOLI8uvk6BBvhoUuxw1CiYMurjSal5kGLLMuukT59U7kRGNSrR7St0olChxRPuyyGXMGWhoBxf3v02o7Erefh0tvWlvIPzX69sTTAqkkpIxbSgPOgmZagQ8H8xwe3HZsz9WxkLMw8NoXLXxpOV5WJVjVLUwhHoxIn86TGpj8nxhueVIKt9Hbj8tm9tn1L8TnciT5tZ2QnM2ozV5Qjrk81AaN9RYwgsp+T7KxEvrEYvlkn4wUVPxTQ05nerh/3wsdFVHDHrpPiRMi95kww7K4OP/sumkB7wxvLYodYFQ7UEheoctdEXUVtqpcX3MvMVRx+daUHCXSfpxRLtjxhNFBVyP1rypOBkPvDY8eUF3jS3Jqa2psXiLyax1yINw2+0ABPuEZZXIJZY186+XGthNtgV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o.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2024 13:23:09.9171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba01107f-e77b-4480-dd8a-08dd25b07132 X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f1905eb1-c353-41c5-9516-62b4a54b5ee6;Ip=[58.252.5.68];Helo=[mail.oppo.com] X-MS-Exchange-CrossTenant-AuthSource: SG2PEPF000B66CD.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR02MB7311 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A05042000E X-Stat-Signature: 366i18atow4ifkdsz46z4saa9yeigjta X-Rspam-User: X-HE-Tag: 1735219355-63233 X-HE-Meta: U2FsdGVkX19sk6BEDvp/LMcsJaMnX4vo3O0GsqKtpS9RRWEYqFM7guTaRYC9VyVfPLdNOgN7zr82EmUO8ZGXduG3bN9QbDJMkx4SyY05R/i62YVJDE6eC4sJwQPMPQsnruAFAE174aHqebfbdTNaKY7jyY9Z/00msZnGqM17dw9e/iwZ7NxlAZ4F6e/wv99IQj4kOnn3nDEdxwMINE3d4NphAdVoOXUsLYEkoX8vMvwch9C+rNCoQOuQWBu6GYB4L74FhEvqrRNTBO6NAqD/nSYBzsEw2X+reYUoguecGhzW8z76ljXrNpyBdN0YHzO5NZ2RH+n+icCtiRorITPOIykoRlrejJhjqea3rQo14a/E9ZwYUgFqKKu5OviFyoqWT2aG8Q913/3+Oi3WRZ5Q720BREOxQZNwGqSRdCRiSfzOojzo4DNAz4/Vzh7tZJwt5LFsQASZ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.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[RFC] mm/madvise: enable files from read-only block for MADV_PAGEOUT
|
expand
|
diff --git a/mm/madvise.c b/mm/madvise.c index 8e5bf11af1b2..503ee5e03b7e 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -337,12 +337,13 @@ static inline bool can_do_file_pageout(struct vm_area_struct *vma) return false; /* * paging out pagecache only for non-anonymous mappings that correspond - * to the files the calling process could (if tried) open for writing; - * otherwise we'd be including shared non-exclusive mappings, which - * opens a side channel. + * to the files the calling process could (if tried) open for writing or + * file from read-only super block; otherwise we'd be including + * shared non-exclusive mappings, which opens a side channel. */ return inode_owner_or_capable(&nop_mnt_idmap, file_inode(vma->vm_file)) || + sb_rdonly(file_inode(vma->vm_file)->i_sb) || file_permission(vma->vm_file, MAY_WRITE) == 0; }