From nobody Sat Oct 4 01:39:02 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A6C235E4F4 for ; Thu, 21 Aug 2025 20:07:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755806880; cv=none; b=GFc8XnyK3mweSK1BUa+Vg8+khTxUyNYQk1DKiWyV1y9xcdLTrGAQNE4SMzl0vq9gjV/AwLQTMgCFMWCfL8y8qtyTT6aQUAWWR3wUfn6XU9zxj9AZg2uDGfYeCcN47CMIQm+BPuaBJ7M1nReJ1jhcWaeF8OSLWJ/ca1BM3pU3pqs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755806880; c=relaxed/simple; bh=jeuBd6AEd//7dLky0U/9/K8CcfgAIF74DmeLEQ7xh6M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pzf4qT4eLFy47oo8P/gk5pmD6Vqpx5tS0TqMDqlTztN57XKoS/5MN+98UPGfGyxEcG++8o5WdR4ei8LuKN4BcopEhsP0RUu2+nHvfjV7K+1j9Yn6ENxdvv4uIhv9tdFkTAlTrGHZ2ITpsrhn1GcGZCn6zMSQ1+l1vO32AKaVpTI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Cc7k8vzI; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Cc7k8vzI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1755806877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NPs2EdTZ9fd3MpWdb0ATDCa6nUqfGtFMv2uyZP7L+uU=; b=Cc7k8vzI8vWyxlhOTg3zj5LNGjaDshsiz6wO+Ms72EVhWwZd1ayoq4w78xvhwzeswURLhd sTkMrm8c281eBuTMugA4EQ0gLZR/hym/wLnJuwYj0b/EGcngrTVom43mob3elWoOAbQwg8 yXIaPVKhDlpqvvHwwbMbC25+SHd0wvM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-156-1NKUWEi-PwOwCTZDr0ToAw-1; Thu, 21 Aug 2025 16:07:55 -0400 X-MC-Unique: 1NKUWEi-PwOwCTZDr0ToAw-1 X-Mimecast-MFC-AGG-ID: 1NKUWEi-PwOwCTZDr0ToAw_1755806874 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-45a1b0514a5so6771745e9.1 for ; Thu, 21 Aug 2025 13:07:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755806874; x=1756411674; 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=NPs2EdTZ9fd3MpWdb0ATDCa6nUqfGtFMv2uyZP7L+uU=; b=MZvRHlg3TEbse/XQhieauPoVw7WikUHIIA2DYGqeGjD6FxLUX7U94S4tKLFiokIC/o 9IXDUeunZLuyfkoxYje+H1AZlisPaXk+thnd7okcIKB79XqOfp4FARX1b/aU0/y1lcNH u6y1anAIl5Rm3Tjl2NP01q9RVN9BsIofwfstkKFjEUG8J2knfwrX2Mn6GNVUfnXUTDEI /OoxB0yZHilJUKGKmEIGNL5kfVGpQ9Mo4HjrM0QV9TCFYU1GcfaoIqMgmJL5kRTkZhu+ /qvM+GiCbP/fIj6UJXCIfvMB18/YmnmAID+YGYwdrjuuebDtov1aZt0iviaVwWFzToMj 6AVA== X-Gm-Message-State: AOJu0YzM6dyo1pWguL1e2rPL9C9/tCmcWshsKJyOg4AqEbIuwpNvVhmV D4gy/mB0A0QlYYzdkC/h6QXfIOb6Y0/YOFiPJOG0gk6IZHfAYWFZgG3w/aasQ2ZGW3LLZdK9Bgj BZbTK/98gKzADg/Hcv3pDG1eOlejO/VmzNZVfQUN3MXBzSNMUiSRQmg7ZKdw+qa9Tk90khLmK6x 5LFxozyY3TjZ65cF7SAqV64rHYJBmrWN7e5SwGCHgnKYWmCSZi X-Gm-Gg: ASbGncuMVZDN93uQqddVawNvICzXqRJEGH/TFtaHTe0YifsRo4M3wVH5Eg4iBnraDju oCtQ9kC9RuF1QoAGdU+QTrtdsU3nonw91hrFHYUe55N4cN4vslxH60SgL1iJ3lUL1F9/vJva6Ov moSWzo0w3HPuEOX/9y91Ametv43QGZYuDx9FndXrncn1Zn07OdV9/hE12G+bgHJZ+MiPzQ8xkd7 RKx9doXoDiiB0PspiicE2cGrzUFTwhXvG/gC7h24ExsC7qc4Du96N5ZRkTx0Dml4dl0ZMimad4b 4bDrTFfjAVakjDzOphuqAuuTyFm73ZjVw9XujsBI9E2IGq0m4vT2/F1Dt0Ax0kxnkVhK/T4uWXB B5GQzevuSavSsIzsngZvZGA== X-Received: by 2002:a05:600c:1388:b0:459:d451:3364 with SMTP id 5b1f17b1804b1-45b517d40f2mr2554595e9.24.1755806874378; Thu, 21 Aug 2025 13:07:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFo8ikhW4DoWVw60oDeAXqMRvn4UERlcVawLCjGel2pacwRc1R1ONhYVQm5EzuW0YIJQT4FDg== X-Received: by 2002:a05:600c:1388:b0:459:d451:3364 with SMTP id 5b1f17b1804b1-45b517d40f2mr2553905e9.24.1755806873856; Thu, 21 Aug 2025 13:07:53 -0700 (PDT) Received: from localhost (p200300d82f26ba0008036ec5991806fd.dip0.t-ipconnect.de. [2003:d8:2f26:ba00:803:6ec5:9918:6fd]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3c07487a009sm12690403f8f.11.2025.08.21.13.07.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Aug 2025 13:07:53 -0700 (PDT) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: David Hildenbrand , Alexander Potapenko , Andrew Morton , Brendan Jackman , Christoph Lameter , Dennis Zhou , Dmitry Vyukov , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, iommu@lists.linux.dev, io-uring@vger.kernel.org, Jason Gunthorpe , Jens Axboe , Johannes Weiner , John Hubbard , kasan-dev@googlegroups.com, kvm@vger.kernel.org, "Liam R. Howlett" , Linus Torvalds , linux-arm-kernel@axis.com, linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-ide@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mips@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, Lorenzo Stoakes , Marco Elver , Marek Szyprowski , Michal Hocko , Mike Rapoport , Muchun Song , netdev@vger.kernel.org, Oscar Salvador , Peter Xu , Robin Murphy , Suren Baghdasaryan , Tejun Heo , virtualization@lists.linux.dev, Vlastimil Babka , wireguard@lists.zx2c4.com, x86@kernel.org, Zi Yan Subject: [PATCH RFC 17/35] mm/gup: drop nth_page() usage within folio when recording subpages Date: Thu, 21 Aug 2025 22:06:43 +0200 Message-ID: <20250821200701.1329277-18-david@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250821200701.1329277-1-david@redhat.com> References: <20250821200701.1329277-1-david@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" nth_page() is no longer required when iterating over pages within a single folio, so let's just drop it when recording subpages. Signed-off-by: David Hildenbrand --- mm/gup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index b2a78f0291273..f017ff6d7d61a 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -491,9 +491,9 @@ static int record_subpages(struct page *page, unsigned = long sz, struct page *start_page; int nr; =20 - start_page =3D nth_page(page, (addr & (sz - 1)) >> PAGE_SHIFT); + start_page =3D page + ((addr & (sz - 1)) >> PAGE_SHIFT); for (nr =3D 0; addr !=3D end; nr++, addr +=3D PAGE_SIZE) - pages[nr] =3D nth_page(start_page, nr); + pages[nr] =3D start_page + nr; =20 return nr; } @@ -1512,7 +1512,7 @@ static long __get_user_pages(struct mm_struct *mm, } =20 for (j =3D 0; j < page_increm; j++) { - subpage =3D nth_page(page, j); + subpage =3D page + j; pages[i + j] =3D subpage; flush_anon_page(vma, subpage, start + j * PAGE_SIZE); flush_dcache_page(subpage); --=20 2.50.1