From patchwork Fri Dec 13 15:55:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13907401 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 0F6DEE7717D for ; Fri, 13 Dec 2024 15:56:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E78C26B008C; Fri, 13 Dec 2024 10:56:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E28DA6B0093; Fri, 13 Dec 2024 10:56:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA06F6B0092; Fri, 13 Dec 2024 10:56:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id AA06A6B008A for ; Fri, 13 Dec 2024 10:56:12 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 645F080FA3 for ; Fri, 13 Dec 2024 15:56:12 +0000 (UTC) X-FDA: 82890386166.19.3393A99 Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) by imf08.hostedemail.com (Postfix) with ESMTP id 59AEA160009 for ; Fri, 13 Dec 2024 15:55:53 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=hOO2pCAm; dmarc=none; spf=pass (imf08.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.170 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734105346; a=rsa-sha256; cv=none; b=sHcCMpCevNQ2rrZix9y6veK52Xys6c1ymOrI4fMC2RIUNktYuCzOFTj46KnkASgO/QH74G Ggg88EaRX7GsEnftm0lkC/58Ozlw4BrKHI3pKYuT0RPe2yY3VMayfaksqVKX0DWzxkT7G2 pXO5NE8V7zNqY+ER2hrUFaTzbOPOVMc= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=hOO2pCAm; dmarc=none; spf=pass (imf08.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.170 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734105346; 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=HOQaUrSMrbMaSJ8tKHsfpEHyiDws1YYfXq+2bH3/e/Y=; b=LZaITabHbVZPO9pJj10vJv1vOKCAI27fcpedLRHUIlsGwacqcFMwTs4NE2Cryes9G1yC9o yzh8QSocONcuCthwTq3C3ia/4E9SoE7SrOBK1IP811Int3x4lsuTCBX93t8IP/Gh0Q3XPS XkEirwuY7okgJGgd9l8NZbDPfJuQ/KE= Received: by mail-il1-f170.google.com with SMTP id e9e14a558f8ab-3a77980fe3aso6265565ab.0 for ; Fri, 13 Dec 2024 07:56:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1734105369; x=1734710169; 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=HOQaUrSMrbMaSJ8tKHsfpEHyiDws1YYfXq+2bH3/e/Y=; b=hOO2pCAmHqd/4Y8+0daFh9K+3AlX9aMbAn98s3gN1Dzs+7B/bT2OoJV2oo4Xq7oxr+ 7XDTZvTibOXbO+UmU5MUySPbAo1ud85p1c+xckY0zLJLWj5yhPnnLxAebEoNVPx4LFic zE/c7Y9GKmD9W9dgCAtsAGbKuwxz7OKO+ze18dQ5p4x9EnaKlB+QGEkwVWUZrNrgCLLQ XJ3uKrdgGvYl7qBI/P9/A9THOPKcSzJLd1HIyAvEUXplsPS5bChRShDMrjOktN8iNFGY MrF4kVaWvkkt80A0DrZSzTryg9kd3VtP7I/N+jampUmR6LsfDPgegkLR4DKU9nKpOGS0 VMsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734105369; x=1734710169; 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=HOQaUrSMrbMaSJ8tKHsfpEHyiDws1YYfXq+2bH3/e/Y=; b=NHLtckplRTH10hdp7CeNTXozfRHtWgm+qHY/DAT2Jg5NgREoPxRqZDKOubyzdKzz7V gIJOtLDHqdjwZ4Dg4JoDBrm1Bx1sdr1ORGsC0Erc9/heDT2fRfOnEHssm3eaHuXU/UvE a3oRMwFgQUB+INxvBHzNKu0eseB3Nv3ReCoUermBQgDEJkWLSBnR4MVR6wIjTjFTgqbL mO6dBptGU8XB4S9JkjTP3gocKL/kjDWXyVqPL0OSzYbdJf0RnoXf4j4kd1ztt8SqC19/ UGelPEx/g5HvYMW9Jaze6VjqiHPSIXCy/TCI//u3kr+xtVDvx4vBtT5Luu0pUKTfRGb+ UEIQ== X-Gm-Message-State: AOJu0YwMQaPxLBEZRS5rBIR9aZp7nFIS1Ti5UXD5nmUlR4FC7F14Hzeu YTdND+zcpWWI/HF/YTqruvcWRpg0zOg1k5smwagaSquG77jPOxzbWYKvBhncYIfWAk+xj+sp8Xk F X-Gm-Gg: ASbGnctqFwJJRHTYZPsBu7NK1NRwfLHe4K1I/MnKR10pfD/NXY675yOHO9OBhIosOTv Sre7RBuSUjOi8YR/RwGDbKaW+c6SO0ES7jf2FvKHEjdoUu4worcNV3xYGBgJ7UWhq5bp+oH8jac eB4gugGFgzK7h95nRFgiNrEYKuXb26MC8cz23RWjtS9hL2mhH2t2qv8hcd4+twbR7QvS2ADo8Ld mfDwZCJDUGwHETnCu5AIj/DMdS5WILXkKYHeq+bpkMejc8PJsVZTvAIajtS X-Google-Smtp-Source: AGHT+IFBVlz5yZz/k+skWWprsCIycLK8jgnRkqf8RE4HqF0RJQv2gkIr0yeXfbClfRWoooTGgqlEcg== X-Received: by 2002:a05:6e02:156f:b0:3a7:e8df:3fcb with SMTP id e9e14a558f8ab-3b02d788a63mr20845625ab.7.1734105369001; Fri, 13 Dec 2024 07:56:09 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a9ca03ae11sm35258405ab.41.2024.12.13.07.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 07:56:08 -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, willy@infradead.org, kirill@shutemov.name, bfoster@redhat.com, Jens Axboe Subject: [PATCH 04/11] mm: add PG_dropbehind folio flag Date: Fri, 13 Dec 2024 08:55:18 -0700 Message-ID: <20241213155557.105419-5-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241213155557.105419-1-axboe@kernel.dk> References: <20241213155557.105419-1-axboe@kernel.dk> MIME-Version: 1.0 X-Stat-Signature: b3n7bip4rrjfuj7auub4oday3k4de6gy X-Rspam-User: X-Rspamd-Queue-Id: 59AEA160009 X-Rspamd-Server: rspam08 X-HE-Tag: 1734105353-37284 X-HE-Meta: U2FsdGVkX19hkpfAtKkyRhZk7XuDa7ODrr6hq55I9w0MdDxyPvIBkSSWtW4+x7LlpGyT+Q1Yfu3RQ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p1BhIT+Qwuj2Vf0r6yqDHBorkrTsXccUTi8EN0L5jbG3KM6MR4hUvakWq1k2HSpcDgoe44w4vyh+wviJhBlTpOcLGy/1MQnylRvB88A+oiQptpIEJ/hJTugQTK7qTfKG44pgKtvtX9T7GEHutFp4g9+hw8kk73Z57dr5Us8iebfhiS8yYFOxipNF X-Bogosity: Ham, tests=bogofilter, spamicity=0.000020, 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 folio flag that file IO can use to indicate that the cached IO being done should be dropped from the page cache upon completion. Signed-off-by: Jens Axboe Reviewed-by: Kirill A. Shutemov --- 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 cf46ac720802..16607f02abd0 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_dropbehind, /* drop pages on IO completion */ #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(dropbehind, FOLIO_HEAD_PAGE) + FOLIO_TEST_CLEAR_FLAG(dropbehind, FOLIO_HEAD_PAGE) + __FOLIO_SET_FLAG(dropbehind, 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..3bc8656c8359 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(dropbehind) \ IF_HAVE_PG_MLOCK(mlocked) \ IF_HAVE_PG_HWPOISON(hwpoison) \ IF_HAVE_PG_IDLE(idle) \