lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <16d5e5619a4.eae7877614758.1000116132119001499@zoho.com.cn>
Date:   Mon, 23 Sep 2019 21:36:04 +0800
From:   admin <cgxu519@...o.com.cn>
To:     "Jan Kara" <jack@...e.cz>
Cc:     "Jan Kara" <jack@...e.com>,
        "linux-kernel" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] quota: code cleanup for hash bits calculation

 ---- 在 星期一, 2019-09-23 18:02:53 Jan Kara <jack@...e.cz> 撰写 ----
 > On Sat 21-09-19 09:56:28, Chengguang Xu wrote:
 > > Code cleanup for hash bits calculation by
 > > calling rounddown_pow_of_two() and ilog2()
 > > 
 > > Signed-off-by: Chengguang Xu <cgxu519@...o.com.cn>
 > 
 > Thanks for the patch! One comment below:
 > 
 > > diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
 > > index 6e826b454082..679dd3b5db70 100644
 > > --- a/fs/quota/dquot.c
 > > +++ b/fs/quota/dquot.c
 > > @@ -2983,13 +2983,9 @@ static int __init dquot_init(void)
 > >  
 > >      /* Find power-of-two hlist_heads which can fit into allocation */
 > >      nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);
 > > -    dq_hash_bits = 0;
 > > -    do {
 > > -        dq_hash_bits++;
 > > -    } while (nr_hash >> dq_hash_bits);
 > > -    dq_hash_bits--;
 > > +    nr_hash = rounddown_pow_of_two(nr_hash);
 > > +    dq_hash_bits = ilog2(nr_hash);
 > >  
 > > -    nr_hash = 1UL << dq_hash_bits;
 > 
 > Why not just:
 >     dq_hash_bits = ilog2(nr_hash);
 >     nr_hash = 1UL << dq_hash_bits;
 > 
 > That way we need to compute fls() only once...
 
Yeah, you are right, I'll update in v2.

Thanks,
Chengguang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ