From patchwork Fri Dec 20 15:47:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13916935 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 54E93E7718B for ; Fri, 20 Dec 2024 15:48:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DCFC6B008C; Fri, 20 Dec 2024 10:48:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 561E16B0093; Fri, 20 Dec 2024 10:48:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 373A96B008C; Fri, 20 Dec 2024 10:48:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 135116B008C for ; Fri, 20 Dec 2024 10:48:44 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C3D69A0C3A for ; Fri, 20 Dec 2024 15:48:43 +0000 (UTC) X-FDA: 82915769748.02.C220BE9 Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) by imf09.hostedemail.com (Postfix) with ESMTP id 70E6D14000C for ; Fri, 20 Dec 2024 15:48:18 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=qPIgD16y; spf=pass (imf09.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.172 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=1734709695; 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=TZWY6vJPfqFGr1DBynm1KpCMDB4zdovTdnWkeolaIOo=; b=HV35s9pf4zdK4CvMEdsDs0X2G82x8krciIoDIYigHTDyVwf0uxJko+tFkEXv9YfR/ugXzt lU2AGeOlpDw7tNLk8g6Gxx6doBVFYtS2CjVGPApbMoFwmQNEWzFTPwgXcXvV1iACg495tr zUYqq60cJ5AV0dB+TcBQTiguzz72b+o= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=qPIgD16y; spf=pass (imf09.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.172 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734709695; a=rsa-sha256; cv=none; b=eYZzOhzj7r/dPTQwJPEHnFbZml3YtR/XVNu1QayFaAXyWKzz9F50USjnHKu+d4+RuM6pMZ ohSlRi3edjDg5M4WEcWg/wybKWrhKuw5nBT2i28eFSbAmiIaOfSLs+20ZQqzLfAlI7372M Yyag/SQ2T95wRyrTsS2kktWMUbUbYQs= Received: by mail-il1-f172.google.com with SMTP id e9e14a558f8ab-3ab37d98dd4so6582885ab.3 for ; Fri, 20 Dec 2024 07:48:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1734709720; x=1735314520; 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=TZWY6vJPfqFGr1DBynm1KpCMDB4zdovTdnWkeolaIOo=; b=qPIgD16yYcvRlL8yge6honRNfoiZWcJJ1Cd9A75ASIBcMuSxbtpV//ysEEEkkr/Yit aM2ktcBO+RBli0lRBDW/CI9Y+OLYKvQAOBBpxC+WXh/fNzEZPYGea5kNNQuJXnejUapS mU1D9H09/WIutbPb6/PkB6q4/JJEwJF6uQzxQ5M/BCezu51KR99yfZDAd9+4LrbUQB+N hTMBTW4+zVEVVr/kp5pxYq5s3llVJ4xs7c6Lnrbai89kqvWCxM4GgjHZBLqcrbkUuDEL TJ/mnmaeEUswKiTTo5hvVkAw8qb0zqPA6CJlO39NV4MsxtXpPpTvseKiRLS6fCK2aXod riCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734709720; x=1735314520; 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=TZWY6vJPfqFGr1DBynm1KpCMDB4zdovTdnWkeolaIOo=; b=qAwnuLAINVmaoE21Xh+J+Oa8phJjuGTbahNMnT95iOEe+7hMHOtRIPL41v8yudI2Ai Ab+dfTuTd3FW2pFcy4Lnoyj374q7TYTlOTGTfut4/+TvoUmeWFoFOiU6AmWJ1/ktI0xB 6XBAaIn9OFhtf3c1Q+InsOTsnjNSmlAMfpaBud6VK/AIMEJ1Lsw8G6HL/Jj00YIRXtOJ +V7rVaEf5G1JU6K1lcEq2jehzaxRmOzJNsOgbSWbWZiQoxmDaBHmBkJ/cWskjIqCK9/0 Bfr+Qp4v/4Y69OiVdtJclh4gDP5wixT22/JcCjMkgvmO1+vxlJkDIYIm73972CDan6kT KHdg== X-Gm-Message-State: AOJu0YzvRBfLUssoluqUtcRD0dEbYpHpAXRDGuALlNvsLqJwpQkfiXGc THy8Y2VbkgPxTt4T7b0Z/UBMLgIVYOBtXYkqEKJD5qqLcA6gxC8Mkg3yBORgbqZ2hkrkQydlHTv p X-Gm-Gg: ASbGnctKOG56J53byaBtV+crkUOtWIEbCXsFAigw73yOt+bLyVBovXsYnFHuM6c0DoL /toW1dJLyUN8Bqyz+JHWXukr9NQBT44de+InquYgnzB4zoB4RB6mXcmKkYYQnhXTa53LInO7vMl Ja4hHCY7ioD+GcQ0LoMVrSpKJS1nz5XEswApEWp5NLF4aIWxGjFjZxMT9c5WSYjf8Ga6gFfDqrS ZfRrbO/J7c2tOhSeMCud923Ej1R3jzmWuuOBTVCarx/rTH96oMmFl1557qV X-Google-Smtp-Source: AGHT+IFvp8gxmeuG0px26ehs16GxVvbXtCVpdcyc+9Br4GzsJzwQZ198tT+fp2EHMgvEVKANcydJew== X-Received: by 2002:a92:cda6:0:b0:3a7:a738:d9c8 with SMTP id e9e14a558f8ab-3c2d14d1839mr28931745ab.2.1734709720617; Fri, 20 Dec 2024 07:48:40 -0800 (PST) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4e68bf66ed9sm837821173.45.2024.12.20.07.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 07:48:39 -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 , "Kirill A . Shutemov" Subject: [PATCH 04/12] mm: add PG_dropbehind folio flag Date: Fri, 20 Dec 2024 08:47:42 -0700 Message-ID: <20241220154831.1086649-5-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241220154831.1086649-1-axboe@kernel.dk> References: <20241220154831.1086649-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Queue-Id: 70E6D14000C X-Rspamd-Server: rspam12 X-Stat-Signature: mfrejbnz79tu4chnff7pnctm9xbf7tqn X-Rspam-User: X-HE-Tag: 1734709698-413814 X-HE-Meta: U2FsdGVkX1+NLcXeb1WYe0SbBavmK9EPn0ygk6AKYUT7DWI1/NlvXSCM8N0yKvFUrP7tVNISmiKxQ2wm4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UwGCc9baPIHyWSWOJ8qA/XDo0bCkUu7onlDu9qbllAkE1QH0g7O+Kj2k3Gj0bttXQANIjTELwjXmrUXH3ldIxbn55cVlXy/w/qgqOjzjv22g9bykxMmlXYMjMBLS9YhF6Lo66fA+aEnu1ok31kEu/P6n9CrDmSSgsvgbGq2CCDpVmdkmqKBjEN6YxkC3A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000014, 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. Reviewed-by: Kirill A. Shutemov 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 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) \