lkml.org 
[lkml]   [2022]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] proc: report open files as size in stat() for /proc/pid/fd
On Mon, Oct 17, 2022 at 6:47 PM Andrew Morton <akpm@linux-foundation.org> 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.

\
 
 \ /
  Last update: 2022-10-18 07:03    [W:0.111 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site