From patchwork Fri Nov 8 17:43:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13868796 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 9DD96D64072 for ; Fri, 8 Nov 2024 17:45:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A3B76B00D8; Fri, 8 Nov 2024 12:45:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 651286B00D9; Fri, 8 Nov 2024 12:45:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F2636B00DA; Fri, 8 Nov 2024 12:45:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2C8836B00D8 for ; Fri, 8 Nov 2024 12:45:21 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DA343C09A8 for ; Fri, 8 Nov 2024 17:45:20 +0000 (UTC) X-FDA: 82763653686.16.04A009A Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by imf28.hostedemail.com (Postfix) with ESMTP id 4E996C002A for ; Fri, 8 Nov 2024 17:44:41 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=zozP61g0; spf=pass (imf28.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.180 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731087867; 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:dkim-signature; bh=9QDQ8u+XOjRX6rdX1KxWEpFxXqQ9HPCp5iTXnKjwIis=; b=eb3J4ACDa/QxAyq2unbnJHaKnDMFxbMjGmPZoVCHw0tDQGci7wSqMNCqxJrb82JqMzJjKp dr2hF8zP3cgLOuSO5zEo6NkPmJEaZ2UU7viIE0s4N2Qh8+zrdi0mf1r6+nw2ruPEfxsqtQ d2WZEblygTqf+MBO946+kc/rP90w1QI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731087867; a=rsa-sha256; cv=none; b=WlLngFJYxq4k63/OdzGbv97dR3y90ilzLoqGbxt+2Ttt+qBHzBQWq1FqKIYUJNH9uNpmYI SbQN4PPXWDEDOvvGguXQwLHCHtRcgtwJU9wgTrYfTPsRRzS0cD55BzMsIi4jY3oS/WIpU7 rWjWECXWZhuGGvWUr6uIi5MKRVNi6ig= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=zozP61g0; spf=pass (imf28.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.180 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3e6010a3bbfso1610411b6e.2 for ; Fri, 08 Nov 2024 09:45:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731087917; x=1731692717; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9QDQ8u+XOjRX6rdX1KxWEpFxXqQ9HPCp5iTXnKjwIis=; b=zozP61g0voQ37QalKGhleDLAYffn2UYZwqSsmrfQVKwinisf4EYgjZ3Mv1lSSpyZ+e 4A+egjM1+VJmgjzlUB6L2QEcOIxv72vK3w9eobBoT9ZuOYtjeayElTJtgSJcmsNUYgWD L2uX4oqUtiiwHw2mPH/x1t/BlQ/6tqyjszlvvacvzGMauKkbT+ZLb/zUxJmd2HGaKhEj /dWwuUt9ksJEXzNWo/SVQhZg4MN6m21toDpZE1A5pPDuT4NWxGAuwn1nC+e1I4PEgW3W l/PR9EZdMFUlCn66jNvpHPIanGpCP4G9Or7whATL6lthHKdjjrtTDWcQMp3TBYtwPK5l YanA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731087917; x=1731692717; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9QDQ8u+XOjRX6rdX1KxWEpFxXqQ9HPCp5iTXnKjwIis=; b=CQqVt3fsy1riqQ57PCQDORoZADBz8fJSlQUVxvpIvzYbDGGyQhiWEFTQb491jqkMdu +mkDsyc5oAtL/wKSL/JUfGG+wa8azZPMigXs1XGnBtQX4oBDf3CmhWamLR+FGsTczaYo Ckdr/fL2mFoMC7vDJPpEKVkJ+TUNssAAVyHE3xuSKKsrPUeq62a0dfe9LDQMIugntAWl iiOS1D5+IIQU69XKyEyhh8NcNZhAWxJrZ86STT24zOL3V1lnaCRmfL35iBnwpN9UrhsQ lpqOhCey/t9d3fxNIWrUwkvOyvm3AYI0jnbFZZvl7OPbzC7bgC0plQxC6BrVAhQk0ged xnKg== X-Gm-Message-State: AOJu0YzMMllT9oxV3xNIm7k38Vr0dKo5/pxconLgeKnqsvFWN+RnwfN8 2Wg6x/dAIP8TNLp9BpnBstPHCWcIJz/8Hz7kHLb6i85jy4J96rIpKiT9/MmdG/LZhtZkWcLi7dJ h1oo= X-Google-Smtp-Source: AGHT+IEFLKzY9PDxLtI3q9tzu1PwOWnBFTiZM//bYtu3vxzi/sNq0OsnpZ8TGg2ZJ4XyTsEPnsyfQw== X-Received: by 2002:a05:6808:1789:b0:3e0:7d53:251 with SMTP id 5614622812f47-3e794675decmr4661644b6e.15.1731087917560; Fri, 08 Nov 2024 09:45:17 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3e78cd28f80sm780969b6e.39.2024.11.08.09.45.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 09:45:16 -0800 (PST) From: Jens Axboe To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: hannes@cmpxchg.org, clm@meta.com, linux-kernel@vger.kernel.org, Jens Axboe Subject: [PATCH 03/13] mm: add PG_uncached page flag Date: Fri, 8 Nov 2024 10:43:26 -0700 Message-ID: <20241108174505.1214230-4-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241108174505.1214230-1-axboe@kernel.dk> References: <20241108174505.1214230-1-axboe@kernel.dk> MIME-Version: 1.0 X-Stat-Signature: aqdg73obihk8g3xz14yfymq9659j5kp6 X-Rspam-User: X-Rspamd-Queue-Id: 4E996C002A X-Rspamd-Server: rspam02 X-HE-Tag: 1731087881-666032 X-HE-Meta: U2FsdGVkX1+0RgWdef0TXplmVO/DQMwyJ80CH+AGssSTYJS2BXSfaKb5Q9/JEw1WLr1wv1Sr/ENF57IgQjuB+OhkNtLSUzzCb1o8FVFbdsg/itZRTCwMfYR38WcONg03m5OZ8GRD1JBvf4S9Pb8a2wREwX4SghFEgAhjTkxN9BLR5qdtxVUfY8/PDkOXUVAOrs2hll4kEUmuZjangaUQJrDJ5/pGhTreDRi03JPyiyt2JFX8keldIPsaqcn6ShtCMy+4woKNL7TiWRum4yuIv2Uf1ZCkfZHn+/5gdFq2u4EtQz0PLwXwyDb9ivjojVwjdZnpoVCV56exTQ1BzGssulXytNI05LKQ629CmVCpcW07/5hR5IRHQ/9/2zMcWl2yf5XS++bZtx4qXQy0EDgffZSwBSkBB6uN8M375Mz8kmwQvtN3miaZ8FF+UzR9R1olUN2Pxm+X0pZr+2pCuLZCSFgr8AWT2e1NzA8HIhknNVNN7S5mQYP/FdKluuG48l4UWXdimPu9XMtN65e67AfBhF34oqxIt7cF7cp3uce7opO7W6fIKsbjmZxKRQiNq5OZqDlPCAGwm04UcA/Og55JG5hrauNUdIMk7kZum4j29AL0nZqBIdQO7SJTWm/VvrI9qSfIVonMFiMcguaaz19r4hqyL49ISgzlXIe55oDG2cHRlBSqEIziLqHr/Z7rW+61yv2+525HvVTUx5V/HtSzs3sI5llQavaI5cvGf8p5QFWqmqzuLIIYTl4nbMcjvDMnwJMH5TWxu/s4wTLsJncHeZ4ziLQLueYRHpsTRuKjOq6YGFSssO8QFtXDa4/hSGAPE1livmEl3/G9ewF748R9UTfqL5qNbxBwlhCHy1buufAUuN+sueNThv3ZZvt9oXjG7L4SRIjkaAkNnVvsQsooTlTyVu4KmcHfBzZcEwc5t5ywgmL2phTFzq7T9M3bWyrLolahOWPom74HATIpGSH WiN2E2Mi inFdh4JuB98mnVyeG6l4mwlwGVvQbsFYE+BCGQhhB/CwzfyU74KrF71uEXSoS8fRQ4sZjyxlM2bHu2+vGwvoDifTa/w5hexcKz/r7ID6olseXtbSOIlGdPTQWS4tDhuwLZVKt2TvIxBlskGivH3iEHjRMbvzH3gomAer1xpAgZu+bpg85D+9aYIKVjZ9KToppWoSkVz7ZHG8xVVL6S3xHn55HyGxkCttOw9in9KZJh2fH0KtKNufiAmJqlMTUBEfEReBvqazVq6OT3iBV09v3jFtPJNWN4kv0BKJVS1UxxYPJ3Zmg8oV14Mhp/AlZ1I33RappMwaoVbPKPHke1Zvg79FcAm6wvV39lqsb 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: Add a page flag that file IO can use to indicate that the IO being done is uncached, as in it should not persist in the page cache after the IO has been completed. Signed-off-by: Jens Axboe --- include/linux/page-flags.h | 5 +++++ include/trace/events/mmflags.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index cc839e4365c1..3c4003495929 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -110,6 +110,7 @@ enum pageflags { PG_reclaim, /* To be reclaimed asap */ PG_swapbacked, /* Page is backed by RAM/swap */ PG_unevictable, /* Page is "unevictable" */ + PG_uncached, /* uncached read/write IO */ #ifdef CONFIG_MMU PG_mlocked, /* Page is vma mlocked */ #endif @@ -562,6 +563,10 @@ PAGEFLAG(Reclaim, reclaim, PF_NO_TAIL) FOLIO_FLAG(readahead, FOLIO_HEAD_PAGE) FOLIO_TEST_CLEAR_FLAG(readahead, FOLIO_HEAD_PAGE) +FOLIO_FLAG(uncached, FOLIO_HEAD_PAGE) + FOLIO_TEST_CLEAR_FLAG(uncached, FOLIO_HEAD_PAGE) + __FOLIO_SET_FLAG(uncached, FOLIO_HEAD_PAGE) + #ifdef CONFIG_HIGHMEM /* * Must use a macro here due to header dependency issues. page_zone() is not diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index bb8a59c6caa2..b60057284102 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -116,7 +116,8 @@ DEF_PAGEFLAG_NAME(head), \ DEF_PAGEFLAG_NAME(reclaim), \ DEF_PAGEFLAG_NAME(swapbacked), \ - DEF_PAGEFLAG_NAME(unevictable) \ + DEF_PAGEFLAG_NAME(unevictable), \ + DEF_PAGEFLAG_NAME(uncached) \ IF_HAVE_PG_MLOCK(mlocked) \ IF_HAVE_PG_HWPOISON(hwpoison) \ IF_HAVE_PG_IDLE(idle) \