From patchwork Mon Nov 11 23:37:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13871487 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 DFBF2D3ABF4 for ; Mon, 11 Nov 2024 23:49:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4794B6B00D9; Mon, 11 Nov 2024 18:48:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 426E16B00DA; Mon, 11 Nov 2024 18:48:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 278EE6B00DB; Mon, 11 Nov 2024 18:48:57 -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 061F96B00D9 for ; Mon, 11 Nov 2024 18:48:57 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BD289C191A for ; Mon, 11 Nov 2024 23:48:56 +0000 (UTC) X-FDA: 82775455224.08.5FEDD81 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf04.hostedemail.com (Postfix) with ESMTP id 03C6240018 for ; Mon, 11 Nov 2024 23:48:02 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=AR46BxLR; spf=pass (imf04.hostedemail.com: domain of axboe@kernel.dk designates 209.85.210.175 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=1731368847; 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=jvfAlDie45/dO/q2Oa4nMUlSYRbUQddnQckYeJvFoiA=; b=Vb3rose1J0RcXxDusxclKNOwQ5xNejHgI9BaOGKzG96LS+/AAjaWSg8l09ifKayXvzEdTj qa3HWrtJvXEF4QM6galssYuF/po7/JhIlEt9O+rUOK+SxFyMGJZS4HmtzimtFvhaSPvLe4 x+aqxjzCSimeOpOQ0LvmSi2/pFeVHMs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731368847; a=rsa-sha256; cv=none; b=F3QLwb3NY10lN1yXID9h1vUMOm0efOGkuhf0LhBDga4mzXzCpha9c+pSYrdTtflkqRRoNs WJmfDkUP2/8MA2rkqwIWQdViSdr42CnUhVb/quxs0/ittS+dBgxfBSam6jvQQk+TuFkbqd fCb+te94wcKFjJxov8bnWBkqv63UoZQ= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=AR46BxLR; spf=pass (imf04.hostedemail.com: domain of axboe@kernel.dk designates 209.85.210.175 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-72061bfec2dso4622402b3a.2 for ; Mon, 11 Nov 2024 15:48:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731368933; x=1731973733; 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=jvfAlDie45/dO/q2Oa4nMUlSYRbUQddnQckYeJvFoiA=; b=AR46BxLRUfngD5cKVZNuXbcjpV334SGgzLv9H5GFwyGIXjpGGjVI+dRGC5mXrtlvXF koe3/FT4Tf7N2fZexefYWa7nJ/1BI1KO8Zpmg3mXsecsrg880WditHLPzBNIsp0IQxnj RA/K4327c/ziqdzRZo5ml9AriBClyI2SkAkuOIXLohqCQlTt/4KDaPGDp1sLaqokWg8a 7CjAbkpP9YpJGLrr4oy/p2itUSjxvvJfukzqxWtaP6xU3rX34eaP8LZSYXmmse6eArfJ PDiry89jOoiZfXYTFLpXW+fCHKffhYfTUJrrWzPoF3HlcOtN8+70c9BJtCtW64w2KJ6p gcvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731368933; x=1731973733; 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=jvfAlDie45/dO/q2Oa4nMUlSYRbUQddnQckYeJvFoiA=; b=YJVfhGQkJTvGp+VuuzCBQHBbkv+mjinTYcStLw2eHmtYfrigYL+3HD2qIrixT9cOsv XvobdTUTltp7aQ/oMDb/w8SAO/T5bTuT/sCL5zHYDyU/nvpRlv7De+L/A7iX0xHS6QSG j1+AP6RnN9ygYRzCG/whl6/H/HGKDzCL/Z4jgUAE6v3DlcnG1O0jWjfM13kILxzHLfb0 15+KAzm3jEG2p3qo9FwYAG3aUa2hOciB3rUAXSA+YsOw58V+5m+Z8iMzZlh5pn6dKdnU 4AzjmvwykreN9iAmbmKU10AIADBG/o48Hh0hpYvtZ031CjH2BsYD4Nyzy7XONECjSGEx 5N4Q== X-Gm-Message-State: AOJu0Yw04SegaykEQjPyI/umoa8zC0g952lvcSdupESzTHSaGcHNneN8 KXIs6rLJ9JKL8ncCaAO0SlVCbqOtOrY+JkRIwzLH1cEIw+xa8gEFyX5RXuWIgL/rSrPl1AVXGV4 vwHQ= X-Google-Smtp-Source: AGHT+IHeHxas0hJ7ji/qpv6NspxjwSxpVOtrX7CmDHrNgbtKnM+jsbZo98ZnZg8WufLJazefZ+DkyQ== X-Received: by 2002:a05:6a00:138b:b0:710:9d5d:f532 with SMTP id d2e1a72fcca58-72413380f6cmr21319143b3a.19.1731368933147; Mon, 11 Nov 2024 15:48:53 -0800 (PST) Received: from localhost.localdomain ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724078a7ee9sm10046057b3a.64.2024.11.11.15.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2024 15:48:52 -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, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, Jens Axboe Subject: [PATCH 04/16] mm/readahead: add readahead_control->uncached member Date: Mon, 11 Nov 2024 16:37:31 -0700 Message-ID: <20241111234842.2024180-5-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241111234842.2024180-1-axboe@kernel.dk> References: <20241111234842.2024180-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Stat-Signature: m36958dzc1c3rewpnyd6gig77nkqk164 X-Rspamd-Queue-Id: 03C6240018 X-Rspam-User: X-HE-Tag: 1731368882-635720 X-HE-Meta: U2FsdGVkX1/8wgVCGirhpFt6qjp4CYssDlO/QDORqxKexCDqFbUZM46FRwPVl1iFqV5ovVQ2zmriBY8BSKlIkWgU41AaQak79jGttuz8kbGdfrlkm2uJPKrqK7BiZDqS0aItOPZmllZKTL8LRe0c+T+Po2pBnHpeMV5azA6s0J76ckSOB6slBI+mAoMjH95m5F9fUUJRujBnrJ/Qa5FysUstlOInAHmjXZbiDGdR0x35opZ2hjFe4xlhFIhaRx3eGQf3HXEAqGwI/Vtv0lKIVrPpm0LnthT8wPy3++4ai05NLJ3GZ9sMApmuBm4WKioXwM8ZyOLDx5Qbol7pd8GMeG3i12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gDk= 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..8dbeab9bc1f0 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; } /**