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: <AM0PR04MB4481249A8F1B729E8E2AC41F88720@AM0PR04MB4481.eurprd04.prod.outlook.com>
Date:   Tue, 5 Mar 2019 01:49:29 +0000
From:   Peng Fan <peng.fan@....com>
To:     Dennis Zhou <dennis@...nel.org>
CC:     "tj@...nel.org" <tj@...nel.org>, "cl@...ux.com" <cl@...ux.com>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "van.freenix@...il.com" <van.freenix@...il.com>
Subject: RE: [PATCH 1/2] perpcu: correct pcpu_find_block_fit comments



> -----Original Message-----
> From: Dennis Zhou [mailto:dennis@...nel.org]
> Sent: 2019年3月5日 3:14
> To: Peng Fan <peng.fan@....com>
> Cc: tj@...nel.org; cl@...ux.com; linux-mm@...ck.org;
> linux-kernel@...r.kernel.org; van.freenix@...il.com
> Subject: Re: [PATCH 1/2] perpcu: correct pcpu_find_block_fit comments
> 
> On Mon, Mar 04, 2019 at 10:33:52AM +0000, Peng Fan wrote:
> > pcpu_find_block_fit is not find block index, it is to find the bitmap
> > off in a chunk.
> >
> > Signed-off-by: Peng Fan <peng.fan@....com>
> > ---
> >
> > V1:
> >   Based on
> >
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpat
> >
> chwork.kernel.org%2Fcover%2F10832459%2F&amp;data=02%7C01%7Cpeng.
> fan%40
> >
> nxp.com%7Cebb4d3d31dca4c76ec2e08d6a0d587fd%7C686ea1d3bc2b4c6fa9
> 2cd99c5
> >
> c301635%7C0%7C0%7C636873236308905172&amp;sdata=POM0aLB5P7g3y
> p6oD5s8uDY
> > 629jfIeo4hko4PcqNA70%3D&amp;reserved=0 applied linux-next
> >
> >  mm/percpu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mm/percpu.c b/mm/percpu.c index
> > 7f630d5469e8..5ee90fc34ea3 100644
> > --- a/mm/percpu.c
> > +++ b/mm/percpu.c
> > @@ -1061,7 +1061,7 @@ static bool pcpu_is_populated(struct pcpu_chunk
> > *chunk, int bit_off, int bits,  }
> >
> >  /**
> > - * pcpu_find_block_fit - finds the block index to start searching
> > + * pcpu_find_block_fit - finds the offset in chunk bitmap to start
> > + searching
> >   * @chunk: chunk of interest
> >   * @alloc_bits: size of request in allocation units
> >   * @align: alignment of area (max PAGE_SIZE bytes)
> > --
> > 2.16.4
> >
> 
> So really the block index is encoded in the bit offset. I'm not super
> happy with either wording because the point of the function really is to
> find a block(s) that can support this allocation and it happens the
> output is a chunk offset.

I just think the comments is confusing, because block_index is not used in
this function or returned. However the function returns a bit offset
in a chunk for caller's. I understand block index is encoded in the bit offset as following
            block_index     
              |
              v
Block   |----|----|----|----|----|----|----|----|----|----|
Chunk  |------------------------------------------------------|
                |
                V
               bit_off in a chunk
and bit_off = block_index * PCPU_BITMAP_BLOCK_BITS + offset in a block

I'll leave it as is, since you not prefer.

Thanks,
Peng.
> 
> Thanks,
> Dennis

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ