From patchwork Fri Nov 8 17:43:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13868797 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 50030D64072 for ; Fri, 8 Nov 2024 17:45:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 20D066B00DB; Fri, 8 Nov 2024 12:45:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 197FD6B00DC; Fri, 8 Nov 2024 12:45:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 011CB6B00DD; Fri, 8 Nov 2024 12:45:22 -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 CE0636B00DB for ; Fri, 8 Nov 2024 12:45:22 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7D3ED40E38 for ; Fri, 8 Nov 2024 17:45:22 +0000 (UTC) X-FDA: 82763653728.18.DA20D9D Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by imf15.hostedemail.com (Postfix) with ESMTP id CFF19A001C for ; Fri, 8 Nov 2024 17:44:42 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=elTKsb5Y; spf=pass (imf15.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=1731087869; 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=nPkGwSldMNFXF3cURXd1feXLkclwp0ZCxyEpzT1cPW4=; b=f5OTZGt1SqFyEfuTPOyvzgJE+SHf+OA8WxoidN9SzNcKIqCKtW1Iqk6SRyrwmxcbyJfRRB HHyYCLTy6KvnGenlxQNNJfHbYQtHjGcbDu2BlIxKpSdne/h2eEQIYwCunsPg3/NrHQM0VS mOKeeeLodLIjhjBUC6iA6DzpBIpi1vw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731087869; a=rsa-sha256; cv=none; b=f/O13NWfTqD24VXHNMjgeecq/3OoRgNsejPhCpIip6Y6/AQICwsfRFuR8aTj8uzTebCTxA CJCroNk9ptH4/DdjhhR+/UP54ehs7JU0ns9534GavHr5AYn+KbQZW1fQZI0y8Jhy91n0Iv A7K7HDy11avEcF/CSNcRvsdStPzGn+w= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=elTKsb5Y; spf=pass (imf15.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-3e6104701ffso1630400b6e.0 for ; Fri, 08 Nov 2024 09:45:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731087919; x=1731692719; 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=nPkGwSldMNFXF3cURXd1feXLkclwp0ZCxyEpzT1cPW4=; b=elTKsb5Yp3N4qJw9uvQu773MrTba0z5+4rw7YCA8SecIIr0niVd98DMO8uvhIpVZJK FtYfYn1HCr8nbAn/AZqYcgyCVr0sqZ2C8QLzHeJN8nvX1jIm2lDcDIRv7Oj4GDMtIVuu KSdrNjY/BIMlZiUIoPFLO71K18VEUcQo1Hmyc4OPeNSYDqB1sEwWKCdgXhvHdefSMVom UNRSzKc+GHIpn/v1Z2WkV9KakAg9I9YFpP83p2OpfEY/oSwfxdsXDqz/9Klz55Pr/pym v6Atp/2SOVPXHL7JDFNg/lmgvfOSVe56/g6oKK34nq4M6mVFSphQ+uFpgBcT6QYx19t6 Zlpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731087919; x=1731692719; 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=nPkGwSldMNFXF3cURXd1feXLkclwp0ZCxyEpzT1cPW4=; b=WCHCuK7uEEnOX+ixJKH/ZvNv6NHIYG5FX1LFSo04X3296bcryE0U5dPTNTFRhB+G7M HGoWZ0tEU0HhgAJcelOwV7DDy3NKWg8VcNy2/P3hCrx/bVadJu3uc8z73BnFeFYR1o+/ U07H8OHZfoyK2VhklMCRX/1pfg8Jv/CCbOJYayP5lDdF/KQVonxpWF/tmPinGohMfzDn e6xf+SjI6jUNhFV//7yik3XFGN5Dkm1s1EQ+0iVEpWQQB2z0yLWoKX/lPwOE7VjeDPyf OzhY01c6LJDC7B57Z5aiq+S7PwwBipMdwWITOzUE6DeZ4CFGHlnseKthOSO3FjJaQsFP E/ig== X-Gm-Message-State: AOJu0YxHnOkI+b0cB7F3KhzN6N85MTt4XaxfOV4pVi5XosRD4hFicTeC +MRqxKp4euM2Sef+UwF6lj+yGMkBWAtl0dkGk11QF3YgZjRoIzEId8p/Obr4i8rKx/hiHfLFzAP pqbU= X-Google-Smtp-Source: AGHT+IF9qnEH6iAmuqzMOZRDZm41rR73Vxyg2vpcvzcsSJsHVKcaTPsimGzR6K5FioRiJT7HzzWlGw== X-Received: by 2002:a05:6808:2119:b0:3e6:134e:3b90 with SMTP id 5614622812f47-3e79470a347mr4589807b6e.30.1731087919330; Fri, 08 Nov 2024 09:45:19 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 09:45:18 -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 04/13] mm/readahead: add readahead_control->uncached member Date: Fri, 8 Nov 2024 10:43:27 -0700 Message-ID: <20241108174505.1214230-5-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: wizidmqh9q3n9ycoi9t3rgyqij9ttb6g X-Rspam-User: X-Rspamd-Queue-Id: CFF19A001C X-Rspamd-Server: rspam02 X-HE-Tag: 1731087882-354017 X-HE-Meta: U2FsdGVkX1+1V1U/1C+uQBjEFnITwJJjBZ3swOjB6FB3tnquSh7pq8gCh0BzmTJp7d7Xm7iIYZnd0G0WH+CxWIbI/BnPx8l9Kj1RgyslKhRghNtKrNlKjIbaeAD2RLx6pGUtO1DXAXTQ1N+ZHfKXvNZ3IjllXLNcT3rzjHa2HPy+jJLWbmBfLD+FZ210hpcw4p1Q9v5ryPXs+rUpYH222dkA4vM8ke+VQQfsWEfC/s5uP7tC/7tHlBSrEzuws5JSKv6fEneRgnEIIVOTw5luc2aT0X0AVybJ/ZWEVjwDNVawfNwqcEMeB8VIaoK+UyQVKUaUeg1ydutJ/NEV5iUoXgjuMpcFizHxn0t1tCwm5YjuEqFvijg3Ifd0xF/XUgV80nU9shrhG8R6X65O00VcHO7zjVy6E8WXnH+yg6V73jjaiQUvXczw9JfSRtz9Ljhki5XQRZ+gwUej2XBSG2wlbQQYLd2xz15NCmdcajFwx+s4OA3XhJF4QyDUjFDnojHRSocGikLNPeq0oPz4Q3FgpC/djI0gLvtwBWiGFNhpzX0YW5Z0HiI7E9dSSDVa370VpZ2aVPQ+z52xshzAH40vNp1bLY5zpupm6a+5gWJDofYBo9XbYlV9ejyZPs131YU63aiQ78qarHsSIFXA366LCr9cCUDJyCnB8vDh/R8i3jrI9U83UrknevWY8f2I5kMgyn4sD39Z2YsWO/PEFhf8//8XVQn9MEL0CVmQvbipaSBWaJ0rxvFiWjPlh1hRr/wctaPTSEQ1rS/a7k6lopZjwJXlaYIT/VBt6bSy/B/rlGxWXOQI4xFL8RtrVlOhumbZAGV/rzwnDqizjWjDSwDwkt8IdpSS1NVl9K77CGApnaTJYbzlmnFnMXG2++CcWPKWqD7QEhI1IVgpAbEAkZvPwLMt0GlO0C4IubMmPXgPayGAsHG34Sqb3SotbWB8XQiCgjbEO30Zi9Hs/gffkNY ddojdOQI GlEmL0ZM4hOCnmQSCf/Jx6f3mK+wqah+VosRGuj1lsnRCghYt+qMZVNK+DH3OzJn9715xZMWi2o3zSVshOJzrqJfoJ/W7tFB8fsys5EZdnQnG5k9FRb/zdkLYECrPDWAAoUUSfZCCBjbjkPIgGgjBIrBpMG/j8O69U5T0rJ8JbtDZmAmRe5XvmWuiWfpW5ATrewxnoJWOPwMgEGamETA+eSwkOIyAatahpW2EsqS/1x0zrTsdJbXBnpY+cvDu0vZF8K6ro7PKaYBlh4Mv27xPi+DJ/wc5WZkGShvNrSAvceUeBT7aohilOimat4h7Wy33p23qP7vXQtZXsLukDUmVQOgI5Pn1hvgzH/7S 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: If ractl->uncached is set to true, then folios created are marked as uncached as well. 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 68a5f1ff3301..8afacb7520d4 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1350,6 +1350,7 @@ struct readahead_control { pgoff_t _index; unsigned int _nr_pages; unsigned int _batch_count; + bool uncached; bool _workingset; unsigned long _pflags; }; diff --git a/mm/readahead.c b/mm/readahead.c index 003cfe79880d..09cddbbfe28f 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->uncached) + folio_set_uncached(folio); + + return folio; } /**