Linux-Samsung-soc Archive mirror
 help / color / mirror / Atom feed
From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: akpm@linux-foundation.org, alim.akhtar@samsung.com,
	alyssa@rosenzweig.io,  asahi@lists.linux.dev,
	baolu.lu@linux.intel.com, bhelgaas@google.com,
	 cgroups@vger.kernel.org, corbet@lwn.net, david@redhat.com,
	 dwmw2@infradead.org, hannes@cmpxchg.org, heiko@sntech.de,
	 iommu@lists.linux.dev, jernej.skrabec@gmail.com,
	jonathanh@nvidia.com,  joro@8bytes.org,
	krzysztof.kozlowski@linaro.org, linux-doc@vger.kernel.org,
	 linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-mm@kvack.org, linux-rockchip@lists.infradead.org,
	 linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev,
	 linux-tegra@vger.kernel.org, lizefan.x@bytedance.com,
	marcan@marcan.st,  mhiramat@kernel.org, m.szyprowski@samsung.com,
	paulmck@kernel.org,  rdunlap@infradead.org, samuel@sholland.org,
	suravee.suthikulpanit@amd.com,  sven@svenpeter.dev,
	thierry.reding@gmail.com, tj@kernel.org,
	 tomas.mudrunka@gmail.com, vdumpa@nvidia.com, wens@csie.org,
	will@kernel.org,  yu-cheng.yu@intel.com, rientjes@google.com,
	bagasdotme@gmail.com,  mkoutny@suse.com
Subject: Re: [PATCH v4 01/10] iommu/vt-d: add wrapper functions for page allocations
Date: Thu, 15 Feb 2024 20:05:55 -0500	[thread overview]
Message-ID: <CA+CK2bBTe93nXzY3Qhty+821LrkjBVnQDxro3m7Y-GVihSP18A@mail.gmail.com> (raw)
In-Reply-To: <b008bd2d-a189-481f-917d-bb045c43cb07@arm.com>

> >>> + */
> >>> +static inline void *iommu_alloc_page_node(int nid, gfp_t gfp)
> >>> +{
> >>> +     return iommu_alloc_pages_node(nid, gfp, 0);
> >>> +}
> >>
> >> TBH I'm not entirely convinced that saving 4 characters per invocation
> >> times 11 invocations makes this wrapper worthwhile :/
> >
> > Let's keep them. After the clean-up that you suggested, there are
> > fewer functions left in this file, but I think that it is cleaner to
> > keep these remaining, as it is beneficial to easily distinguish when
> > exactly one page is allocated vs when multiple are allocated via code
> > search.
>
> But is it, really? It's not at all obvious to me *why* it would be
> significantly interesting to distinguish fixed order-0 allocations from
> higher-order or variable-order (which may still be 0) ones. After all,
> there's no regular alloc_page_node() wrapper, yet plenty more callers of
> alloc_pages_node(..., 0) :/

The pages that are allocated with order > 0 cannot be freed using
iommu_put_pages_list(), without messing up refcounts in the tail
pages. I think having a dedicated function that guarantees order = 0
pages allocation makes it easier for the reviewer to follow the code,
and ensures that only these pages are put on the freelist.

Even in the existing code, the order=0 allocation is wrapped in the
*alloc_pgtable_page() function.

Pasha


>
> Thanks,
> Robin.

  reply	other threads:[~2024-02-16  1:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 17:40 [PATCH v4 00/10] IOMMU memory observability Pasha Tatashin
2024-02-07 17:40 ` [PATCH v4 01/10] iommu/vt-d: add wrapper functions for page allocations Pasha Tatashin
2024-02-09 13:44   ` Robin Murphy
2024-02-10  2:21     ` Pasha Tatashin
2024-02-13 17:26       ` Robin Murphy
2024-02-16  1:05         ` Pasha Tatashin [this message]
2024-02-07 17:40 ` [PATCH v4 02/10] iommu/amd: use page allocation function provided by iommu-pages.h Pasha Tatashin
2024-02-07 17:40 ` [PATCH v4 03/10] iommu/io-pgtable-arm: " Pasha Tatashin
2024-02-07 17:40 ` [PATCH v4 04/10] iommu/io-pgtable-dart: " Pasha Tatashin
2024-02-07 17:40 ` [PATCH v4 05/10] iommu/exynos: " Pasha Tatashin
2024-02-09 11:26   ` Marek Szyprowski
2024-02-09 19:00     ` Pasha Tatashin
2024-02-07 17:40 ` [PATCH v4 06/10] iommu/rockchip: " Pasha Tatashin
2024-02-07 17:40 ` [PATCH v4 07/10] iommu/sun50i: " Pasha Tatashin
2024-02-09 10:55   ` Jernej Škrabec
2024-02-09 19:01     ` Pasha Tatashin
2024-02-07 17:41 ` [PATCH v4 08/10] iommu/tegra-smmu: " Pasha Tatashin
2024-02-07 17:41 ` [PATCH v4 09/10] iommu: observability of the IOMMU allocations Pasha Tatashin
2024-02-09 11:17   ` Robin Murphy
2024-02-07 17:41 ` [PATCH v4 10/10] iommu: account IOMMU allocated memory Pasha Tatashin
2024-02-09 10:50 ` [PATCH v4 00/10] IOMMU memory observability Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+CK2bBTe93nXzY3Qhty+821LrkjBVnQDxro3m7Y-GVihSP18A@mail.gmail.com \
    --to=pasha.tatashin@soleen.com \
    --cc=akpm@linux-foundation.org \
    --cc=alim.akhtar@samsung.com \
    --cc=alyssa@rosenzweig.io \
    --cc=asahi@lists.linux.dev \
    --cc=bagasdotme@gmail.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=hannes@cmpxchg.org \
    --cc=heiko@sntech.de \
    --cc=iommu@lists.linux.dev \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=m.szyprowski@samsung.com \
    --cc=marcan@marcan.st \
    --cc=mhiramat@kernel.org \
    --cc=mkoutny@suse.com \
    --cc=paulmck@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rientjes@google.com \
    --cc=robin.murphy@arm.com \
    --cc=samuel@sholland.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=sven@svenpeter.dev \
    --cc=thierry.reding@gmail.com \
    --cc=tj@kernel.org \
    --cc=tomas.mudrunka@gmail.com \
    --cc=vdumpa@nvidia.com \
    --cc=wens@csie.org \
    --cc=will@kernel.org \
    --cc=yu-cheng.yu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).