Re: [PATCH 11/11] afs: Fix dirty-region encoding on ppc32 with 64K pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 28, 2020 at 05:05:08PM +0000, David Howells wrote:
> Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> 
> > > +{
> > > +	if (PAGE_SIZE - 1 <= __AFS_PAGE_PRIV_MASK)
> > > +		return 1;
> > > +	else
> > > +		return PAGE_SIZE / (__AFS_PAGE_PRIV_MASK + 1);
> > 
> > Could this be DIV_ROUND_UP(PAGE_SIZE, __AFS_PAGE_PRIV_MASK + 1); avoiding
> > a conditional?  I appreciate it's calculated at compile time today, but
> > it'll be dynamic with THP.
> 
> Hmmm - actually, I want a shift size, not a number of bytes as I divide by it
> twice in afs_page_dirty().

__AFS_PAGE_PRIV_MASK is a constant though.  If your compiler can't
optimise a divide-by-a-constant-power-of-two into a shift-by-a-constant (*),
it's time to get yourself a new compiler.

(*) assuming that's faster on the CPU it's targetting.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux