From patchwork Sun Nov 10 15:27:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 13869948 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 129BBD12D44 for ; Sun, 10 Nov 2024 15:29:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E2636B00AF; Sun, 10 Nov 2024 10:29:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 493DA6B00B2; Sun, 10 Nov 2024 10:29:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E5396B00B3; Sun, 10 Nov 2024 10:29:23 -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 0B4056B00AF for ; Sun, 10 Nov 2024 10:29:23 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B6BD1C0426 for ; Sun, 10 Nov 2024 15:29:22 +0000 (UTC) X-FDA: 82770568608.04.94C7047 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf28.hostedemail.com (Postfix) with ESMTP id C309FC0006 for ; Sun, 10 Nov 2024 15:28:40 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b="Sh/jkn19"; spf=pass (imf28.hostedemail.com: domain of axboe@kernel.dk designates 209.85.215.179 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=1731252420; 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=8TKhBEozykjd5XmlwYr9i65jd4Shwg3isDOnZadSS+BfCqPbUxtmFholHsQ9ycmfLxdnqW sb03fLnQ3+yF+KyfR7ToaRO7/vjmDyhvo8l8S9OtHHgB0QcrdKk534zzq3edloVKpK7foN 17LSPKFsPV7GuQwQe+8l1QVdHzVf1xY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731252420; a=rsa-sha256; cv=none; b=tk53o1+FhiVfzgKBOvZEZW/st7qZvkkpXRKic2rc0U8KSm8VVtuwCkJHK2HUFl6OfEpnTt efXjSvcq7j2Xiz3QJ+POasql+cVqHYubfLH59lSIylp47luRu3sBrZgf+QbUDMYmRYx2GF zAzCkZewXVMK2oNRtgRpzheJJ1OVgrw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b="Sh/jkn19"; spf=pass (imf28.hostedemail.com: domain of axboe@kernel.dk designates 209.85.215.179 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7ea9739647bso2613479a12.0 for ; Sun, 10 Nov 2024 07:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1731252559; x=1731857359; 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=Sh/jkn19XHD9Jog3WwLAosYywGUw5yL2sShIEEsA6c9j+XxbqTk+3mwwB+cO3F92QI 60gUutz7T/Wx41A2eafzgpfDw3nmf/0qzSwH4YZxXpnHlwyYvlsrqN4ePCwlDqY06427 1iBz9V/Rx+H5xn5HjcWBy+jUytQ578QEw6q6xkv3QaDvGzL/JDHctz+zoppElQZounAK 6X+QAg1iYfdXvVSMdYHFnFkzJwZS7nZI9P7fYXamJrSvRHgkEejSngVeiDYSZ7LMKWqe F8syLrfm+4SGS/yYkCTpsVBOgSSCIrGK+sUGQIcE1VpCXiT3fu0rlQv9e2bo25vANqHe 9i7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731252559; x=1731857359; 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=YlLqc+lCWznJN9Q3RpTEKgfJTLOF0U4jfa1KZR8Na+qOd78zzIBCurj8UTzSifnEs5 WeSY+uSEBZu+Fx6MHSbNnIqU8ZkaX8dL080cJTcAJffZaNi5KNUQpCv7s7IsX0BwXLhi QCPZQv5ZObSa+MKuh9Mc3tLVvEcjN+t09CaGhdu6ZoCMxhL1pQcQw+RSOlBBmsn+/sLl Emsc7OBkV9NGIvyLB4NPr/L5u3byxEZeOaPW3+F4IzZn0DEqqPn+2Q3pXo7hi95RcOPA 9F4UTKhWMzvfAAWazYOmPNGJ49nhKjfeW4f0Qu9zlpdZmbZaw3j6I2JFMOX4aZKoOo2d YMRQ== X-Gm-Message-State: AOJu0YxZDBGaTVNJBEW6sgaxO2eIXnILpe3dn4Pe3kS5zC/WRYNrwQbU B7hSRoAJ/WWdCXFQB+7qIJuNI04zMACU/8gDk0Xt4njMB1sGHDzIOULILnhVSeJLruaBksIDDPQ ZFUI= X-Google-Smtp-Source: AGHT+IGu/u+FhGsz3wBr1Zsic2L7vJ+0uwzRrgnEJRvL3npe1QZdpxBowle6ldDc43UF6F8F8hYjFQ== X-Received: by 2002:a17:90b:2ecb:b0:2e5:5ab5:ba52 with SMTP id 98e67ed59e1d1-2e9b173f1ddmr13558707a91.20.1731252559257; Sun, 10 Nov 2024 07:29:19 -0800 (PST) Received: from localhost.localdomain ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e99a5f935dsm9940973a91.35.2024.11.10.07.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Nov 2024 07:29: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, willy@infradead.org, Jens Axboe Subject: [PATCH 04/15] mm/readahead: add readahead_control->uncached member Date: Sun, 10 Nov 2024 08:27:56 -0700 Message-ID: <20241110152906.1747545-5-axboe@kernel.dk> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241110152906.1747545-1-axboe@kernel.dk> References: <20241110152906.1747545-1-axboe@kernel.dk> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C309FC0006 X-Stat-Signature: 49iqiaon96tnjhg8k6u9m8o1y86csdtf X-HE-Tag: 1731252520-405578 X-HE-Meta: U2FsdGVkX1+jP0p4T33qgCrYWYRNx4ZdDy9wowwG3KEw9UCWxnnOYNSHEFv+Ulpq2l5ryWzQWspv4DoFIAFZF4luOf8sVEmw+kAnoorAxqrEBXFmE8gc1JfU8dH4ei3woKoM/4y32EHpjXMkdujoUU6l26hUIwSSHhnAR30ee/LDKz9aUKFvGpB2uM+oyTApf7HqVEmWKJWXMaUDBuy2wYPcmyEpnLTeq9zqu5sUdMhqkvE4Cq3X773YUh+WSyTJdYPhV2cRA3YYqOyipnTEbP+UmnK/oaLVXkgdYnR5GmGobbD7uHMOiEbjD+Qk1H3okuwxYPnhGXG/TWPzKP2pglMSx4Cm4D6tppJlZ/RS+1XBLP2wgczo9tAAO7tEUJIU4b9ptRZPTJ+LAzjRA7/KkbM+GEVmO3N3EFBJ0ZH1jbwZwIQuNsoh5RDNCH/Ggufo4mIkakxlig8meI26gHfq39e4scN+uIqp+cc6cWPKXeX0dLfjI8xvKGNvsu7fAf+czmYNkzy2wkr82/9QJ+0fyl8TBsvqyr+uPKfxDhd/++UuDL/GJ37Ao+p3L3qED1BaM5HPKFKFYQYNk7o/qzOT3vFsHvaVsW7W/v35BizqOXhdHToUJskBZiclQexL2j0KulrzpYAFkzKOe7cOCa5yT47zrPeygJvqNrXXWMVXHYPgI2R2Q55jNqp6FM5K4kNThZdK0p5yAe5H6iCWecU/vvR4rO1IQ0jjjFFA3lF/mc3faKjYcmreIprSQEpum/oc69p3gpEkVPqJM9WaJrC6iyCiziF77YBcFF1PqQ4fggtwNAhydh15aA7nc0jUjh1YxnRE/+HzNo/L/wx8jBYHHo0Q9yOnHOOGBdJ+iZ2lmiglRQka9svzvoMcr+dMBJKGqZYCtf7141JSApHxx/k8VJnVN75ZgMgNpv/h8VXCulwba+fvGVgSyc2+JlThX0AhFR2HePRw/fcGBTJVQHR hXjEvjwy 70EBvPtcLsjMsBSmu/E55ic61Qg16BDz78eMB2AAR6NA5pFteD0Dct+3/RYUeQMiI2wLr9FkPYWwGypZZit4YYNgER9Xuq+RNWY56tkYQ/amOOZZzyhKw4633bIrvA7a6SmWCWByTNji4pj0k2ygWhll5YSjwmMVlI85tDU5JDgza48F4o1EtiHCz+8fI4WOR5+akNA/zcYpqCsjPPAX/0hEjITi0gYK+NvzatbfD4eZ93M08Xi281GPHgSAuXt1OIZfLlAw8FZP2m527yl2iaSDmfiAI8M41qWdUP/+oi/BNg49XOJAgBunxQQU0Q5xhRNg6VQOYApXOi1CEAFZoq57ktikaInF+96Ja 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; } /**