From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 4F582369337 for ; Thu, 21 Aug 2025 20:08:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755806894; cv=none; b=o32uWLWU/B5S8YQsG5m9mDdVifn+snkc9USUZbvA9PlmgS5TWuUxLCiaIBQ94Mmw3v7reqUCRYCmZq9GYmWIZ74vsR6cs4pg2UiBfib2/pChAaOS7+UVQ5+VUqO+1zi4J38w8vn40wZQBCUzEpNPO71590q+hysH5BnmP9TJrv0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755806894; c=relaxed/simple; bh=35i5s1BcLEONuxohRPeqiFHOreLIpfTF289+ZIXZu/s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q0Tw0eKOwZ4vcEw7/bapGVEhxMboptOV4mS+jGGUK2uZWzwRRREE9xj5DLd9BHB+YhvRLoqvOIs3hBdhmLef7ogPDFHimbOmJm6Hysp8TGXIz4I2JVJPbKMDTmgUJn9Xm3e04ItH349ZCJrQL50+8Jcfp0+gLzeqXpKbVX+UfIg= 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=iy3wgKBi; arc=none smtp.client-ip=170.10.129.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="iy3wgKBi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1755806891; 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=Pq6EMCEhMXNA7HGNe/O1qYHWHhWZrBzRdRZ7YmKumJw=; b=iy3wgKBi03EyZ3sRdRWSgr84psZuJtpBypQHP7law3eYFY+FVr08x31c3sGqpwjxqAGmTX xqBGUqiu8RyAPg93w1dvnEzol1HjwjQI/m6o382BgrH/D7lRFhyqnnqDsexkYq33pFBhbr yj7lMaG4r48RcxYaH/qGbQzbdKtKz3w= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-543-bhyKR39uOvqkLW0Flr5Ekg-1; Thu, 21 Aug 2025 16:08:10 -0400 X-MC-Unique: bhyKR39uOvqkLW0Flr5Ekg-1 X-Mimecast-MFC-AGG-ID: bhyKR39uOvqkLW0Flr5Ekg_1755806889 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3b9edf332faso441205f8f.3 for ; Thu, 21 Aug 2025 13:08:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755806889; x=1756411689; 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=Pq6EMCEhMXNA7HGNe/O1qYHWHhWZrBzRdRZ7YmKumJw=; b=WGxoRSzSJqmr4NJevv2sttwKZoECD2uPHGpDsd8Vrjxk2iTIo4exk+XrCEdtavyKli EAtdY6PCffCyGetoZV/PdrtwueN0ojRq0QaP1dzKFVTua2gbhXf732h2pEwY26dzCp/4 ZI9Yvb9EvaId1dsoMrg3YbTc+RSf7zhHxqZTqPSg6X9TwuQ1aLFmkqB198s7mQSAQxf+ SR9wPLy7M20qy6RhKbDBmPMGx9SSkIqCvUaAvWBOC11QTycm3DKb3wrQTufK8x/z+4s6 nyWZGS8qaXI1JAqg6dvrw4Gfsfv4v9oC4qJg2AzoqwmAHbkbsDSvcrErdjyteAF3AK3F 6yIg== X-Forwarded-Encrypted: i=1; AJvYcCVha5R4NTQDHdifpE394n90a1BwkdEsWVLqIXhXzjJ6+8u/FeN7+Dr65b5p31k4+3RdxFfG5kgMywk=@vger.kernel.org X-Gm-Message-State: AOJu0YyxZKIsuXZpTioMoob0jHUueBC/rZboOdJAmndEMfA8exm9X6pB YS4+2Yu0n9cHJOz/9QTDt7g6/+i/IUW3b+eZWcArJBgXYwhwmerAdKBDwc67ZePLLYsSodODgd8 Cv41H3Tn7EId/6MJ6gOHxrl9O0hTHfrKkhgDWk0wXNIpiNBi7VxDgX/m1rGl/gQ== X-Gm-Gg: ASbGncs6gzMVDxCRReJsSheYZ5a1tdmvS1K5lzlEseDuMCxlBtPwtEMK2ZkioFvEG38 WKxBu6ejbs8pjis5BIDpXe1MFFhkgqs9NuLNnHVICdEzs3UCLGRDfxrBqJyRuO447vZQFxg6QEY WLFuK7GaGOGftGSzohxM+Ju8HulX/L5/kHlELCQrTs5HcLr1NFx0Qpv4zcBoNNi6v/9Op92lSFz 0twoorV6y6aIXFA2Gm+MOrV2kLjvbd/7c9bBvYV9uYuGSi6vpYhfmEHJZl41bMtPu4hCzQT2fSy 5ztd5Zcb+IOnJV28urnZfjszusgNBC0YWYkP1eRFKeDKvkKXEcQKLWM5791mI1x00JC+FezL4rX /Mwnhzx/f9h1SonW6sCDqQQ== X-Received: by 2002:a05:6000:40c9:b0:3b7:911c:83f with SMTP id ffacd0b85a97d-3c5da83bf5bmr151938f8f.9.1755806888884; Thu, 21 Aug 2025 13:08:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGeHEkncn914iQLB6IDJFbFllUgyuseH1VcCPvg+Bdgchh7CcvmYDhAXktPsYS0hqHcr6hQuQ== X-Received: by 2002:a05:6000:40c9:b0:3b7:911c:83f with SMTP id ffacd0b85a97d-3c5da83bf5bmr151916f8f.9.1755806888456; Thu, 21 Aug 2025 13:08:08 -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 5b1f17b1804b1-45b4e2790a8sm21120815e9.1.2025.08.21.13.08.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Aug 2025 13:08:07 -0700 (PDT) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: David Hildenbrand , Marek Szyprowski , Robin Murphy , 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 , Michal Hocko , Mike Rapoport , Muchun Song , netdev@vger.kernel.org, Oscar Salvador , Peter Xu , Suren Baghdasaryan , Tejun Heo , virtualization@lists.linux.dev, Vlastimil Babka , wireguard@lists.zx2c4.com, x86@kernel.org, Zi Yan Subject: [PATCH RFC 22/35] dma-remap: drop nth_page() in dma_common_contiguous_remap() Date: Thu, 21 Aug 2025 22:06:48 +0200 Message-ID: <20250821200701.1329277-23-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-ide@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit dma_common_contiguous_remap() is used to remap an "allocated contiguous region". Within a single allocation, there is no need to use nth_page() anymore. Neither the buddy, nor hugetlb, nor CMA will hand out problematic page ranges. Cc: Marek Szyprowski Cc: Robin Murphy Signed-off-by: David Hildenbrand --- kernel/dma/remap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index 9e2afad1c6152..b7c1c0c92d0c8 100644 --- a/kernel/dma/remap.c +++ b/kernel/dma/remap.c @@ -49,7 +49,7 @@ void *dma_common_contiguous_remap(struct page *page, size_t size, if (!pages) return NULL; for (i = 0; i < count; i++) - pages[i] = nth_page(page, i); + pages[i] = page++; vaddr = vmap(pages, count, VM_DMA_COHERENT, prot); kvfree(pages); -- 2.50.1