From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D63DC1D63FF for ; Wed, 12 Mar 2025 11:43:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741779797; cv=none; b=qWChGJ66I/UgyJhy6AVmkSwKJsEbv7G1y3TFk8Lus9eFs/Woq81cohAnNS3G6lIeK26ao4VSgODaFQ5HGtamml6nvEuU6U9FJaKlJ6qxGCHol+DRR5vBc1tKRcK1Rg/mMizKsnaWyJrFccI9FUMAuGtHHS6JnU5I+CS7INqFnPg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741779797; c=relaxed/simple; bh=+MNq83J0FvOykak8Ryzy9D5d1zvEqohQjMDrlpBZzM8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NDQSiCc4HdRLpHDinaQNu0tFXJY9d5xwAMtq69qEZZ/hsAUTrGQqio0bN2CzwQ+5t8qbxlgWuk47/TJc6XWDcy19fBWxuLRD5nD51sexVHcpBBpVPMJ1XXfy1qK6BO6Vdd2TczdsAFkZ7CiwwVnVX0pD/o0B4Kad/l/yGcQPVd0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TQwsur7W; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TQwsur7W" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-43cf3192d8bso39065e9.1 for ; Wed, 12 Mar 2025 04:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1741779792; x=1742384592; darn=lists.linux.dev; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/DRboL7iXAangnAe10zAw/fnPXaxzgNmenGuCjK+wlo=; b=TQwsur7WIWsaXm7xoXHv5M4pWGeWjtVFeUCw3pMgJmvpY2uEwsqrKu9MlUWPCvvVes EoG6ZZvOv/U64KxdJFR2YdsryahOngIB1IXpBwmAUPqqLDBaYiY4XaPQVOI0J2N4Xkht e+726J0x93FTY5D+DQLGyMpBwOieXNwrzJmtb43Vd7WC7cf9zfay+0ehbijJyfwk866K 4StwIyDqyAGJgeOMceHizy6FA948tBlZqZIYBYHA/dflC1DdwrbkocOpu1M+RXHEhHJE AByk6GooIrf0o4+vTQheEBvZvHJoTUU+zba6kyoqwdX3I2tk0edYJiU0Wx1cjHrVMMZU /VuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741779792; x=1742384592; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/DRboL7iXAangnAe10zAw/fnPXaxzgNmenGuCjK+wlo=; b=CtET8ac7wvu/gdcarTHfLPIfmiOhgatN8ISSJirUKDXW28AfUORCE/DfN96VTryEXX i5XTYhzQEimc1+F1IfNxmIllmqP8bKlYjoB63R+UbzFWl86tLONsTj18Upix9bH0o6KV hgl+GNxro47A+5a4EOci7hlc0M2k065VPNilUc34Sx5Qzs5bD3olD7XLwMLLUrdj6ND2 6ZeMG14RG72+Bm2Uwl9ZssXyfhl3n84m6g1gMpLztOO7ShDJFyEsdJL2kN9cgG0Mr7lO VLBZiolaNA3pbITCF9Yq/EPbL+QAag7cWxBI8xss5wBnZzwb5OHfDtUyGkZrhrGQKst7 FR9Q== X-Forwarded-Encrypted: i=1; AJvYcCXxpUzgmNq7WR3rou28u24yWWHx6CClASK4YVnoKuLw3dLfCfmb8z4f7IqsyjSdqw3VVsPRPJHQ@lists.linux.dev X-Gm-Message-State: AOJu0YyXeFDPABnRv2n1orASAh4BXxv7R2NLyMAqw9AYBlWk/uIVhNTA ZmsHKTpupWsiEtYZC8551+bLTC2DfjaJ7XES9mToNFSfmeEclajlyOGJYZpkKw== X-Gm-Gg: ASbGncuTR+acx66DTCtx45J4SkN/S76HrTJYBgY7VqpzCo0+sohs/zfh7DoBAp0xNuy hqGE8OZDcBiVJY2vnoCnWE+jjbYkP5s+SJ3AFxhVLqeVGHem0ClRJFlniU4KQfAoYSf4j/2mMBc FFkzHLVKmE5K/Sv87vSk4OZwBddqhc5Lp+za5GWpCQ4Xl4z1TIn51LyfMRnDmgkuCDA490cmO45 NEt1HljVX8HqhNMjqpnEWHTJpBnzCGuFUC5VAZJFU2Tb5o0P2PgFYTU2ZjJtS6vRZz7gja/b3/n F8tNXbCxeW/je9xalotBoKXUZqD35tCe29lCSE3xf+Xba3uOqx2/eoFMsjCCIxCdkZCEvdHLQo8 QSdCK X-Google-Smtp-Source: AGHT+IGAlRZ9FGEpVbzn9/E/l/2Ksb4Pgfv6rI6D7I3wU6Ogl1uoOZwLKHkEYMZpOjmtLPXmOnf3OA== X-Received: by 2002:a7b:c8d1:0:b0:439:8d84:32ff with SMTP id 5b1f17b1804b1-43d0a5e40ccmr994365e9.3.1741779792013; Wed, 12 Mar 2025 04:43:12 -0700 (PDT) Received: from google.com (88.140.78.34.bc.googleusercontent.com. [34.78.140.88]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d0a72ea88sm18970735e9.7.2025.03.12.04.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Mar 2025 04:43:11 -0700 (PDT) Date: Wed, 12 Mar 2025 11:43:07 +0000 From: Mostafa Saleh To: Jason Gunthorpe Cc: Alim Akhtar , Alyssa Rosenzweig , Albert Ou , asahi@lists.linux.dev, Lu Baolu , David Woodhouse , Heiko Stuebner , iommu@lists.linux.dev, Jernej Skrabec , Jonathan Hunter , Joerg Roedel , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, Marek Szyprowski , Hector Martin , Palmer Dabbelt , Paul Walmsley , Robin Murphy , Samuel Holland , Suravee Suthikulpanit , Sven Peter , Thierry Reding , Tomasz Jeznach , Krishna Reddy , Chen-Yu Tsai , Will Deacon , Bagas Sanjaya , Joerg Roedel , Pasha Tatashin , patches@lists.linux.dev, David Rientjes , Matthew Wilcox Subject: Re: [PATCH v3 03/23] iommu/pages: Remove __iommu_alloc_pages()/__iommu_free_pages() Message-ID: References: <0-v3-e797f4dc6918+93057-iommu_pages_jgg@nvidia.com> <3-v3-e797f4dc6918+93057-iommu_pages_jgg@nvidia.com> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3-v3-e797f4dc6918+93057-iommu_pages_jgg@nvidia.com> On Tue, Feb 25, 2025 at 03:39:20PM -0400, Jason Gunthorpe wrote: > These were only used by tegra-smmu and leaked the struct page out of the > API. Delete them since tega-smmu has been converted to the other APIs. > > In the process flatten the call tree so we have fewer one line functions > calling other one line functions.. iommu_alloc_pages_node() is the real > allocator and everything else can just call it directly. > > Signed-off-by: Jason Gunthorpe Reviewed-by: Mostafa Saleh > --- > drivers/iommu/iommu-pages.h | 49 ++++++------------------------------- > 1 file changed, 7 insertions(+), 42 deletions(-) > > diff --git a/drivers/iommu/iommu-pages.h b/drivers/iommu/iommu-pages.h > index 82ebf00330811c..0ca2437989a0e1 100644 > --- a/drivers/iommu/iommu-pages.h > +++ b/drivers/iommu/iommu-pages.h > @@ -46,40 +46,6 @@ static inline void __iommu_free_account(struct page *page, int order) > mod_lruvec_page_state(page, NR_SECONDARY_PAGETABLE, -pgcnt); > } > > -/** > - * __iommu_alloc_pages - allocate a zeroed page of a given order. > - * @gfp: buddy allocator flags > - * @order: page order > - * > - * returns the head struct page of the allocated page. > - */ > -static inline struct page *__iommu_alloc_pages(gfp_t gfp, int order) > -{ > - struct page *page; > - > - page = alloc_pages(gfp | __GFP_ZERO, order); > - if (unlikely(!page)) > - return NULL; > - > - __iommu_alloc_account(page, order); > - > - return page; > -} > - > -/** > - * __iommu_free_pages - free page of a given order > - * @page: head struct page of the page > - * @order: page order > - */ > -static inline void __iommu_free_pages(struct page *page, int order) > -{ > - if (!page) > - return; > - > - __iommu_free_account(page, order); > - __free_pages(page, order); > -} > - > /** > * iommu_alloc_pages_node - allocate a zeroed page of a given order from > * specific NUMA node. > @@ -110,12 +76,7 @@ static inline void *iommu_alloc_pages_node(int nid, gfp_t gfp, int order) > */ > static inline void *iommu_alloc_pages(gfp_t gfp, int order) > { > - struct page *page = __iommu_alloc_pages(gfp, order); > - > - if (unlikely(!page)) > - return NULL; > - > - return page_address(page); > + return iommu_alloc_pages_node(numa_node_id(), gfp, order); > } > > /** > @@ -138,7 +99,7 @@ static inline void *iommu_alloc_page_node(int nid, gfp_t gfp) > */ > static inline void *iommu_alloc_page(gfp_t gfp) > { > - return iommu_alloc_pages(gfp, 0); > + return iommu_alloc_pages_node(numa_node_id(), gfp, 0); > } > > /** > @@ -148,10 +109,14 @@ static inline void *iommu_alloc_page(gfp_t gfp) > */ > static inline void iommu_free_pages(void *virt, int order) > { > + struct page *page; > + > if (!virt) > return; > > - __iommu_free_pages(virt_to_page(virt), order); > + page = virt_to_page(virt); > + __iommu_free_account(page, order); > + __free_pages(page, order); > } > > /** > -- > 2.43.0 >