[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 2 Feb 2023 07:17:48 +0000
From: Lorenzo Stoakes <lstoakes@...il.com>
To: Baoquan He <bhe@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
akpm@...ux-foundation.org, stephen.s.brennan@...cle.com,
urezki@...il.com, willy@...radead.org, hch@...radead.org,
error27@...il.com
Subject: Re: [PATCH v4 3/7] mm/vmalloc.c: allow vread() to read out
vm_map_ram areas
On Thu, Feb 02, 2023 at 11:20:07AM +0800, Baoquan He wrote:
[snip]
> > > + for_each_set_bitrange(rs, re, vb->used_map, VMAP_BBMAP_BITS) {
> > > + if (!count)
> > > + break;
> > > + start = vmap_block_vaddr(vb->va->va_start, rs);
> > > + while (addr < start) {
> > > + if (count == 0)
> > > + break;
> >
> > Bit pedantic, but you're using the `if (!count)` form of checking whether it's
> > zero above, but here you explicitly check it, would be good to keep both consistent.
>
> Yeah, sounds good. Will change.
>
> >
> > Given you're checking here, perhaps you could simply drop the previous check?
>
> Well, maybe no. The previous "if (!count)" is checking if count is 0
> after the 'count -=n;' line at the end of the for_each loop. While this
> "if (count == 0)" is checking if count is 0 after 'count--;' at the end
> of while loop. Not sure if I got your point.
You're right, sorry each break is for a different loop :) and I guess the inner
check is feeding the outer one so we're all good.
Powered by blists - more mailing lists