public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Christoph Hellwig <hch@infradead.org>, Lianbo Jiang <lijiang@redhat.com>
Cc: linux-kernel@vger.kernel.org, thomas.lendacky@amd.com,
	will@kernel.org, iommu@lists.linux-foundation.org
Subject: Re: [PATCH 1/2 v2] dma-iommu: use static-key to minimize the impact in the fast-path
Date: Tue, 19 Jan 2021 15:52:41 +0000	[thread overview]
Message-ID: <c961822e-e768-9d20-87cf-85db95b6aab6@arm.com> (raw)
In-Reply-To: <20210119152641.GA3453587@infradead.org>

On 2021-01-19 15:26, Christoph Hellwig wrote:
> On Tue, Jan 19, 2021 at 07:16:15PM +0800, Lianbo Jiang wrote:
>> +static DEFINE_STATIC_KEY_FALSE(__deferred_attach);
> 
> Why the strange underscores?  Wouldn't iommu_deferred_attach_enabled
> be a better name?
> 
>> -	if (unlikely(iommu_dma_deferred_attach(dev, domain)))
>> +	if (static_branch_unlikely(&__deferred_attach) &&
>> +	    iommu_dma_deferred_attach(dev, domain))
> 
> Also insted of duplicating this logic in three places, maybe rename
> iommu_dma_deferred_attach to __iommu_dma_deferred_attach and create
> a small inline wrapper for it?

Once patch #2 is in place, I really don't see any point. The "helper" 
would add a minimum of 5 lines to save at most 3, and would have to be 
annotated as always_inline - which a whole other camp of people would 
probably object to - in order for the static branch to be properly useful.

It's not as if this is a complex or hard-to-read expression, so IMO 
having 3 lines repeated 3 times is objectively better than having 2 
lines necessarily repeated 3 times plus having to scroll up and find 
several more lines to follow what it's doing.

Robin.

  reply	other threads:[~2021-01-19 15:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19 11:16 [PATCH 0/2 v2] iommu: fix the failure of deferred attach for iommu attach device Lianbo Jiang
2021-01-19 11:16 ` [PATCH 1/2 v2] dma-iommu: use static-key to minimize the impact in the fast-path Lianbo Jiang
2021-01-19 15:26   ` Christoph Hellwig
2021-01-19 15:52     ` Robin Murphy [this message]
2021-01-21 12:21     ` lijiang
2021-01-19 11:16 ` [PATCH 2/2 v2] iommu: use the __iommu_attach_device() directly for deferred attach Lianbo Jiang
2021-01-19 13:40   ` Robin Murphy
2021-01-19 15:29   ` Christoph Hellwig
2021-01-21 12:57     ` lijiang
2021-01-19 13:46 ` [PATCH 0/2 v2] iommu: fix the failure of deferred attach for iommu attach device Lu Baolu
2021-01-28 11:04 ` 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=c961822e-e768-9d20-87cf-85db95b6aab6@arm.com \
    --to=robin.murphy@arm.com \
    --cc=hch@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=lijiang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=will@kernel.org \
    /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