[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d9ce1c62-9e89-dc73-68e8-4e3025b5725f@arm.com>
Date: Thu, 27 Sep 2018 16:35:21 +0100
From: Robin Murphy <robin.murphy@....com>
To: Christoph Hellwig <hch@....de>
Cc: iommu@...ts.linux-foundation.org,
Marek Szyprowski <m.szyprowski@...sung.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 2/5] dma-direct: add an explicit
dma_direct_get_required_mask
On 27/09/18 16:28, Christoph Hellwig wrote:
> On Thu, Sep 27, 2018 at 03:12:25PM +0100, Robin Murphy wrote:
>>> +u64 dma_direct_get_required_mask(struct device *dev)
>>> +{
>>> + u64 max_dma = phys_to_dma_direct(dev, (max_pfn - 1) << PAGE_SHIFT);
>>> +
>>> + return (1ULL << (fls64(max_dma) - 1)) * 2 - 1;
>>
>> I think that may as well just use __fls64() - it seems reasonable to assume
>> max_dma > 0. Otherwise,
>
> Is there any good reason to micro-optimize given that this isn't
> a fast path?
Not at all, I wasn't even thinking in terms of optimisation other than
in terms of number of source characters and levels of parentheses.
But more importantly I was also being a big idiot because no matter how
much I have the fls()/__fls() thing in mind, __fls64() doesn't actually
exist. Nitpick rescinded!
Robin.
Powered by blists - more mailing lists