[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210417202240.GS2531743@casper.infradead.org>
Date: Sat, 17 Apr 2021 21:22:40 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Ilias Apalodimas <ilias.apalodimas@...aro.org>
Cc: brouer@...hat.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, netdev@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel@...ts.infradead.org, linux-mips@...r.kernel.org,
mcroce@...ux.microsoft.com, grygorii.strashko@...com,
arnd@...nel.org, hch@....de, linux-snps-arc@...ts.infradead.org,
mhocko@...nel.org, mgorman@...e.de
Subject: Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems
On Sat, Apr 17, 2021 at 09:32:06PM +0300, Ilias Apalodimas wrote:
> > +static inline void page_pool_set_dma_addr(struct page *page, dma_addr_t addr)
> > +{
> > + page->dma_addr[0] = addr;
> > + if (sizeof(dma_addr_t) > sizeof(unsigned long))
> > + page->dma_addr[1] = addr >> 16 >> 16;
>
> The 'error' that was reported will never trigger right?
> I assume this was compiled with dma_addr_t as 32bits (so it triggered the
> compilation error), but the if check will never allow this codepath to run.
> If so can we add a comment explaining this, since none of us will remember why
> in 6 months from now?
That's right. I compiled it all three ways -- 32-bit, 64-bit dma, 32-bit long
and 64-bit. The 32/64 bit case turn into:
if (0)
page->dma_addr[1] = addr >> 16 >> 16;
which gets elided. So the only case that has to work is 64-bit dma and
32-bit long.
I can replace this with upper_32_bits().
Powered by blists - more mailing lists