From patchwork Tue Dec 3 15:31:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13892621 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 F16F9E64ABB for ; Tue, 3 Dec 2024 15:32:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 380EB6B0092; Tue, 3 Dec 2024 10:32:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 331866B0093; Tue, 3 Dec 2024 10:32:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 15B126B0095; Tue, 3 Dec 2024 10:32:55 -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 E742E6B0092 for ; Tue, 3 Dec 2024 10:32:54 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 77F9E1A09C4 for ; Tue, 3 Dec 2024 15:32:54 +0000 (UTC) X-FDA: 82854039702.17.99C93CD Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by imf24.hostedemail.com (Postfix) with ESMTP id 0EBD1180018 for ; Tue, 3 Dec 2024 15:32:50 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=VJM6RuND; dmarc=none; spf=pass (imf24.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.180 as permitted sender) smtp.mailfrom=axboe@kernel.dk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733239960; a=rsa-sha256; cv=none; b=GC4KFlrtXzFmozVfNkA1Fy8XdRKTG0B5XNpBtTK4QTFF9DN4OHB2b2u2hZ7btbPcmZ0VUb w6y8SUC0ijxBBXBL0Ou3aT83XWx3pd6vTwuhehMgFjXIdNAgr/mushfPHYLj8xWVz9CDb0 AF+hIlShwb1DBTv1yGcINc2b1KpzkWI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=VJM6RuND; dmarc=none; spf=pass (imf24.hostedemail.com: domain of axboe@kernel.dk designates 209.85.167.180 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=1733239960; 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=RwN531wgOLFM8EGeUWgrWwcMRYwBcN09BWbzS6SO3q8=; b=0o9Th8dHBJvYEVnhL2Aa93IN3d1bTtHViZSoa55TTa7AeObveZYA8/xWvRIwq9ZNDFAA9d HUTuzA6bgcXeLtwAlVFiWUZOa6/ATYCTkOy7uwTXtOVdKsU/c7gaDCiPP4lwwNgawYP4XG lcSk48K9GaAq58xtk2MDCxfCxFGJjUg= Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3ea405aa7b3so2867587b6e.3 for ; Tue, 03 Dec 2024 07:32:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1733239971; x=1733844771; 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=RwN531wgOLFM8EGeUWgrWwcMRYwBcN09BWbzS6SO3q8=; b=VJM6RuNDShDKwq6UoGr+kXupDV6UL46sqnAVMq7EX82n6WtKT+BWf6JY6x7spOPzXQ wo8C5+jUnAA4m00376F9Ft4JuPg2G8DSWqq1a/0e7OQZYPjB+AHDAZ+FFzLeTd2evXnV oA4FqFpFsxUX4BJD0EL9iYvhWBtDelmk1dHAm0cEiXX4ZZcaIwSs1vCIiVX+onhWIIYh 7Ey8x2JOrMjBAekl60GBk8fn1NdsxkS+ZaoGWO3Tv0HEKxlp41jxvhk93Ew68QnFFq5S K0w5D156ibn9Jk5kcaEfJfDjLZ7lKt+eVF0VcQQG6vEVFBP0XXaoxNVC7nVjksAuff3o w6uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733239971; x=1733844771; 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=RwN531wgOLFM8EGeUWgrWwcMRYwBcN09BWbzS6SO3q8=; b=oHUN/DX734/dHaoKwgKo4u1Ly89/r1qgQE+vJIC5xqfNCtHc5u4sRNQHFu6d2I0kZQ FI4cxLC6xQ0ekaCMqkVcMlfdtL1N5V0YkZaDwwemwA1sO5pdkTn2z2+dMVx05IVf+aA6 OUf99zIq6b/4tpb0kIDJ89DM8+mt3fZjeIPh0YxHg6m6QQCLOdOr7pvlvC6WNmxDPfvk mvy4G4MUKfx9MT9inJK844D1vMGp5O6o0mGJWtndoX0azrwDJAdeT/EmDoHJiZvbWNrV fS2RBS6AJaPOMq6QQ96CjzprHBPm6OaLr5pb893E9+AoSZmtSHP5XDtXKDYi5ya65JkL zleQ== X-Gm-Message-State: AOJu0Yxy92muY27WNWgXw9aBNeGTRERUL/pyEzbh3u4c1HmIMCxJlFO/ ROTiV+YCKLkMXeJISYvoEEOc3LuISUU/hb69m6hiAZx+ev1f2K6JI5i5FwObruSOIW7S4vF4pXr n X-Gm-Gg: ASbGncsIvY0RkjbX5eNBo06YvPiowsxJs21ORsyRZ3ZDjCMSYjrrM+Fg1jL/EBslhJf L1gQXfe/NaTqDlqw6k4pmYj2qonR/zW3TfQ49RT2uCpymxnNVC0qpMLEjuvcI7itiYiFi5NsKDR XbLviDWy6g2NG0SfO/nSsyhPrQ0jOW/Y9nrowWpjQc0ZbO+25Itm3UbaEiHsy8ZNzVyZxStmpyR G1d8IPG3AWLb1tbtAm36N8XSJxgVqX09C6JaMd7YvG+ZZS9OQwj4uJrUlk= X-Google-Smtp-Source: AGHT+IF9UmPrglgGWAW3JFFN5BU2DOVhhB7roaz8QIV4CUJFyvDEFcQOUcjiZ4xJCcSYYgdgH9P94g== X-Received: by 2002:a05:6808:1405:b0:3e0:c13:9837 with SMTP id 5614622812f47-3eaf041efccmr453615b6e.37.1733239971292; Tue, 03 Dec 2024 07:32:51 -0800 (PST) Received: from localhost.localdomain ([130.250.255.163]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3ea86036cbbsm2891878b6e.8.2024.12.03.07.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 07:32:50 -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 04/12] mm/readahead: add readahead_control->uncached member Date: Tue, 3 Dec 2024 08:31:40 -0700 Message-ID: <20241203153232.92224-6-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241203153232.92224-2-axboe@kernel.dk> References: <20241203153232.92224-2-axboe@kernel.dk> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0EBD1180018 X-Stat-Signature: r8qetffbf5wfzcu5c74sme84e6ozps4o X-Rspam-User: X-HE-Tag: 1733239970-257604 X-HE-Meta: U2FsdGVkX18oRzFOujQBbOtMtM9r5wTx50EWbdpjbXwCeid1AZt5sXIumL6T9foGc4pIyHfcK9GtyD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NPsuloz7v70oAWAM1xWnw7F+qOiPuSwbCE9Rrm2kHkiVNK+MtMpy62d0XXiM6Lch/szpC66UEDCELJD+92WJmVNydhsVBIQGtB1QXy5ahb9H6OQcN+Vc4VRDfebGFFEQ2E+693LHihWbMxV1A/iP8YSeeU9s/+neV7z2oJPh/WmDsWyyIWU4O 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 bcf0865a38ae..72b03b37c265 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 uncached; bool _workingset; unsigned long _pflags; }; diff --git a/mm/readahead.c b/mm/readahead.c index 8424bf1b67e2..33a2d0feae14 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; } /**