From patchwork Fri Dec 13 15:55:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13907402 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 DB47DE7717F for ; Fri, 13 Dec 2024 15:56:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 448646B0092; Fri, 13 Dec 2024 10:56:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C70E6B0093; Fri, 13 Dec 2024 10:56:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 243816B0095; Fri, 13 Dec 2024 10:56:14 -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 012036B0092 for ; Fri, 13 Dec 2024 10:56:13 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B2E3AA101A for ; Fri, 13 Dec 2024 15:56:13 +0000 (UTC) X-FDA: 82890385914.09.DFFEC70 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by imf24.hostedemail.com (Postfix) with ESMTP id 7BDFB180011 for ; Fri, 13 Dec 2024 15:56:08 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=cp5hu6qy; dmarc=none; spf=pass (imf24.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.51 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734105347; a=rsa-sha256; cv=none; b=yth+Ax5h15jqih68Jh+tdA/pYg5rOrq8bofpbPJd8QkK6G+K1j3WTPMdBVrVWpVgJaI2W7 w/GHMqhbUmL5YY9LvoVX7aGpy5bYonjSu5xWusT5JUNH4aEfBTuHsXgysqjAQRSwDH8yml HgnfrejdMyfuApKz4y1LvUr6SiWtjNk= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=cp5hu6qy; dmarc=none; spf=pass (imf24.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.51 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=1734105347; 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=kz0Pdg9jqnEJMYLqH2tprv5bkemx7uetlhB6shaJiPY=; b=FAy3Ih23bhL8mOgknSrzsfeUxwo7ILVS4nEaLvyghFBMIJ8GYR/T9EF0uiBfkYjjsPG5jb FgU887Ei2azR6uQDQMZI8+hzFdeBaDfH2i2uQHSFR+g45vQUcC3EN//WkINqJVSKeAbrKi 4cn4LXfthj11Cfa4iJ10mCfIiiumL1w= Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-844e6d1283aso39025739f.1 for ; Fri, 13 Dec 2024 07:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1734105370; x=1734710170; 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=kz0Pdg9jqnEJMYLqH2tprv5bkemx7uetlhB6shaJiPY=; b=cp5hu6qyfsFVukVTbYmFv9ncuqcZYuJ5osejelS96cThx2txfUkhdkEOJh3YtHHB2E z1ujd24PhrOcVlBuJ5Y5bp998fYvWth8rWOhu69QxV7w3yTvh70f7EZIzTDrYeIO0Mcu owKjPdygsQDZVFB+NF3tiq/lzl3AgO6vHd1U5f9S/1Iy80K9uw9DPdsLgo3e0IxohvcV 4MHyCxaLqwmqF7AV2B28SO8XD2s3YHru3Yqfp7O9QloPFFpOmrx4ZMa/SY3qmbzpNYVX GDfWVqpDOoQ2DEdTc8OTH4hn2UqmpnnCQ8R/b6tRUBAlu7T78XOw2ZrZQO+cIn65GOej yPCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734105370; x=1734710170; 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=kz0Pdg9jqnEJMYLqH2tprv5bkemx7uetlhB6shaJiPY=; b=C95Bb9bsR/JFG61qyKepwz7ILU8alMIgBSXOL0MOuY2woh03epUpAlBIpctHYxGo9i wsEaU4pDc2X8PxWz9MAQ0DRarqwpyXyiv7i947etKD1cE8qTh7TKJNOiL5sqq/fCGjdT bWm+Ddb4Zhtxs0TUBg/h1Q43dhhewPp94MtRu7QBXszggeoUbzBpEGo2b+m9SggMCSpV 5cRwjxFNbu+hUYZXR17aZJmnNDAPAfWCY404m+KTxRhPXb3Kr2d72f4cXcwkJRZbqeSM WkU+UyrqpJ0hQE5SNKgom8z+a6qw1j1Z6fWTLQPkPibTeHO6iI/zzo+IECD+jnXmp4v/ ydhg== X-Gm-Message-State: AOJu0YyBVA1jNmXio28s84ALybKI3BT4yo/tcxZCgcs71Q7H6Yz0+hYW K8ezclNAhkDU49gBGwGy67Rfyp94UdURWqFm3ZF+iGO/Y+CWsFiSW7K6RVgFrem4Jw86MA3vQwa T X-Gm-Gg: ASbGncu3hsgJT631EVZ8UfR5xmANDzwFI9vHFDlKtwWDGA82EkMDkbaEA/wzq/QNlqr Ah8vhguEt6CCGPp8btHaLrDiN4KSmrn6cGC/G632lXyHOuc0NNmxo/V5zq/8izj0GH59QLKsAOd WHMya0YoSVJ4Z/qHSAAQpIKlOX/DbX3aARwJL2SJC4HMMfEo92QBCjt//chJxQS0DdckJmhpkwi X++T/2DlSp4Nzsf1gPlG03oAO64fdfaS7lWKV3dZllBgHgDqIlP4zkZaE9o X-Google-Smtp-Source: AGHT+IHcUplw3Q6ECt5DnQxOZIMw6sSCxN/kZ+qm1VNkzK8N15/r675oe1NRLkEoEeFprb07mxKCyg== X-Received: by 2002:a92:d10c:0:b0:3a8:13d5:bd2c with SMTP id e9e14a558f8ab-3ae61f23bb3mr46583235ab.2.1734105370422; Fri, 13 Dec 2024 07:56:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 07:56:09 -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 05/11] mm/readahead: add readahead_control->dropbehind member Date: Fri, 13 Dec 2024 08:55:19 -0700 Message-ID: <20241213155557.105419-6-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-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7BDFB180011 X-Stat-Signature: y3dyhmq6so38gd5b9xrim93nuc6p3tw1 X-Rspam-User: X-HE-Tag: 1734105368-249582 X-HE-Meta: U2FsdGVkX1/tao5OU4+2CwDGZas18EEiQjyr3YsWQaxum4mFkCPEApj6mZa4tFfX/HeS7JeGEGXaeq4ib827iDABbmh9gJIC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rqQVnfe2rlkiTLhc7Q580hIIJFELXISmo7YxnqBbioJOIzQMe3TIaxjl0BjZv7ac73Kl4PrHBSdA1JHoJknC4UCD23QZTmbo3nA2GNkH0HBLu9evTTjTNx7+k5ZzkBOJC/dQMW20V2yNer1//CyRRtFoA38xXV6uP X-Bogosity: Ham, tests=bogofilter, spamicity=0.000075, 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. Signed-off-by: Jens Axboe Reviewed-by: Kirill A. Shutemov --- 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; } /**