Re: [PATCH] mark pseudo user as deleted instead of removing them

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

 



On Fri, Aug 4, 2017 at 8:29 AM, Christopher Li <sparse@xxxxxxxxxxx> wrote:
>
> There is a few design choice here. We can make ptr==NULL for the condition
> of ptr is marked deleted. We can also use tags to do the marking. Using tags
> will allow NULL pointer as valid entry in the ptrlist.

I think what might be a good idea is to simply replace the "nr" in
"ptr_list" with a bitmap of entries instead.

We already limit each ptr_list[] to 29 entries, so making it an
"unsigned int" bitmap instead wouldn't be hard. So it would be just a
single-bit "tag" whether an entry is present or not.

And that allows easy deletion, easy insertion and easy to iterate over too.

The insertion is admittedly a *bit* awkward, since you have to find a
free bit, but it's either a fairly simple loop or on newer CPU's you
can use the "find first bit" instruction.

                Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux