From patchwork Fri Dec 20 15:47:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13916936 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 C5F45E77188 for ; Fri, 20 Dec 2024 15:48:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 961496B0093; Fri, 20 Dec 2024 10:48:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E4EC6B0095; Fri, 20 Dec 2024 10:48:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69DA76B0096; Fri, 20 Dec 2024 10:48:45 -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 491AC6B0093 for ; Fri, 20 Dec 2024 10:48:45 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 03D00140996 for ; Fri, 20 Dec 2024 15:48:44 +0000 (UTC) X-FDA: 82915769076.21.D045353 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by imf11.hostedemail.com (Postfix) with ESMTP id 9C7DD40002 for ; Fri, 20 Dec 2024 15:48:11 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=BEjMXWVN; spf=pass (imf11.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.51 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=1734709707; 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=Qy66q6foyU2ZBCe4X6zLGxi2eTMkd0mxpiy36jLMGYw=; b=sHTe61JD+l8EK7qgnQvKf0DMW+m8I09xmPhcp9cjHh8bFs/wb7kFzo7nvZn6QerHQc7eX+ qP0DKHToSO84YcXhhTq9E65YbzpYhRwQerAepBSfJt0AUMGX9OeNL8PfmsFolQ4L0Jpswd 6K57ePQ9t9b3qUmzDwaMtgE/zHRV/G4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=BEjMXWVN; spf=pass (imf11.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.51 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734709707; a=rsa-sha256; cv=none; b=LPXh204RsJMy0HXuuioOoDj5hrbJDTpcnRwht31KAWPP6n6Sa/1s1umT4GwyTj/3Gu0N9F sjd0uCudvjU4i+0+ki9oht2cRqDojfFLifLHBNg+KATPkQYikscxr1b6kcmvgIfmVqONEt NsHVplix7/FT+ISl2QuujDtbGgi7Mls= Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-844e161a957so154729839f.0 for ; Fri, 20 Dec 2024 07:48:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1734709722; x=1735314522; 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=Qy66q6foyU2ZBCe4X6zLGxi2eTMkd0mxpiy36jLMGYw=; b=BEjMXWVNhEffzqXrnnroqqCPWxwem7xQejP8YSRr6Q17ZvfoZS0li6Z0/Jct0hLHDx zKVO0xC1sUOQXipNuKca9B8KP58IBpYb1pftJHoM2SBx2THVi6VZjgF1RlOOO/TO43D8 hw9kGaec6ZTbDJzmXLJuDdtuZLVewY6grCiD35yDgP8RdtT3b9XJSL8cEtvu8jVUxTo2 h1nj0jxy0KmtEdyHlXWlxFK7AqTPkVpTfgPLzTaNlTK8yw/ZysuoROAnid4aCh2W9ZZF gZQYsJytK5aUU5fe0GrveOFG8E3SjmQnomXm1RKgChFLQzlpfCusbjPVip+BhL/Z7K+t qq8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734709722; x=1735314522; 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=Qy66q6foyU2ZBCe4X6zLGxi2eTMkd0mxpiy36jLMGYw=; b=U+2RMD149qdb3hV98oyK0OR7EG/0UqZsXU9AzbJO1X7AOL4jyRUnf76CYRkCtgDXOY me+lDkdr5F7jZ4zBb7sS9ZCs5sLHC8w61sD+Ru/clFCl1iX4Um3c2/KvhShzsbTIAoOG HJXu63RbjfJ+cLzgrjUbsi2kl0qAcFKnvPXSNZ52mV6i66yJ0+hki+HZdmphrpuYFn1E f+PpKO1REQNLUCQNIf70mahJXHhko/Tbytvk9ioYo18sraSNiaVGNEU8EBrS4vx8IHgv op4c8W35yRUz/T/2/FhLWbCWy4esiF38fvlYpXflgjefXC8pDc9d1NiH+xj8hkv9Ur8I zHpA== X-Gm-Message-State: AOJu0Yy3TZ2X2xCLbEU5Jkjt+qqc90S8NN/WXSp9PcJqyDtN86gQ5mcf fE8l0AN3qrupi1tE63BslUG/ALastKJJOBhD3VcBcxOKsIKnheh0+8Bgo4KqAgubut7wnOymt9/ f X-Gm-Gg: ASbGncs75Fukh0VApaEx7Nr3TCZ0hS6ObbflKFA3RWH5LrLywyQ++n3T2E/BiwebSdx O9sNkw6eSePzevi+90xLZLOLuDH6prGztdFOSnXgfHqwxfWU7iFqxErS85SiCB45KJtfZgqwkS2 UgMUrQoFt/bWIocVVGl9pd8GT39Qkc4slhHUYKNFa47sU9Vo+OhFcpXDyjCXa0ow5XWW/nYX2uR 8sBq1srlKEQYHWLP0YCENeOa/5eXz7yWuecF0D1nc+g9Rd4ozOcWoEsZZbs X-Google-Smtp-Source: AGHT+IF2sIPl1WVDVbn7fgvbpII69l3j4cwL7QghFjhSCJ3SFTcAXuckA2Q7OzRuPKU0QQKKTwe1pQ== X-Received: by 2002:a05:6602:26c6:b0:841:81ef:70b9 with SMTP id ca18e2360f4ac-8499e605a2bmr323110339f.9.1734709721832; Fri, 20 Dec 2024 07:48:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 07:48:41 -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 05/12] mm/readahead: add readahead_control->dropbehind member Date: Fri, 20 Dec 2024 08:47:43 -0700 Message-ID: <20241220154831.1086649-6-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: 9C7DD40002 X-Stat-Signature: h5x5aiefdkonsis7c9ygjgy9zjaw5898 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1734709691-782733 X-HE-Meta: U2FsdGVkX18BdQz3n/2KHB9UJ4Vxz2pRr5gMa9cQ0dOwKfrqOw3duQTOiLIIEjny2JgJ4izuQJ5De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M7x7cWKK32ikJSuyaj1DEI6249par8QcSUGBgluAoCXSTuPTMvaIhrYqpDWlhpdytyFvxa7I1azT2BS9G6T27ezu2qvoFM/XY6NRQx1TYUncYnWCC+2MLkU2jBr9AkPnEKVGLf7DQbO0rGvGfXKElBEqnUQF85P3EeltG4s7/QvloddeKDgDfSoh31Isvtrahqt4EU+SmZDny5bGaHQxtIXrRu X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If ractl->dropbehind is set to true, then folios created are marked as dropbehind as well. Reviewed-by: Kirill A. Shutemov Signed-off-by: Jens Axboe --- include/linux/pagemap.h | 1 + mm/readahead.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index bcf0865a38ae..5da4b6d42fae 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1353,6 +1353,7 @@ struct readahead_control { pgoff_t _index; unsigned int _nr_pages; unsigned int _batch_count; + bool dropbehind; bool _workingset; unsigned long _pflags; }; diff --git a/mm/readahead.c b/mm/readahead.c index 8a62ad4106ff..c0a6dc5d5686 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -191,7 +191,13 @@ static void read_pages(struct readahead_control *rac) static struct folio *ractl_alloc_folio(struct readahead_control *ractl, gfp_t gfp_mask, unsigned int order) { - return filemap_alloc_folio(gfp_mask, order); + struct folio *folio; + + folio = filemap_alloc_folio(gfp_mask, order); + if (folio && ractl->dropbehind) + __folio_set_dropbehind(folio); + + return folio; } /**