Re: [PATCH v2] proc: report open files as size in stat() for /proc/pid/fd

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

 



On Tue, Oct 18, 2022 at 6:02 AM Ivan Babrou <ivan@xxxxxxxxxxxxxx> wrote:
>
> On Mon, Oct 17, 2022 at 6:47 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> > > +
> > > +             fdt = files_fdtable(p->files);
> > > +             size = fdt->max_fds;
> > > +
> > > +             for (i = size / BITS_PER_LONG; i > 0;)
> > > +                     open_fds += hweight64(fdt->open_fds[--i]);
> >
> > Could BITMAP_WEIGHT() or __bitmap_weight() or bitmap_weight() be used here?
>
> That's a great suggestion. I tested it with bitmap_weight() and it
> looks much cleaner while providing the same result.
>
> I just sent the v3 with this suggestion applied.

+1 from me on using bitmap_weight() - good spotting that.

FrankH.



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

  Powered by Linux