All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Hockin <thockin@hockin.org>
To: linux-kernel@vger.kernel.org
Subject: Re: Max groups one can be a member of linux/sched.h and NGROUPS_SMALL
Date: Thu, 28 Oct 2004 11:21:09 -0700	[thread overview]
Message-ID: <20041028182109.GA29258@hockin.org> (raw)
In-Reply-To: <20041028180230.GD10255@digitasaru.net>

On Thu, Oct 28, 2004 at 01:02:30PM -0500, Joseph Pingenot wrote:
> #define NGROUPS_SMALL           32
> #define NGROUPS_PER_BLOCK       ((int)(PAGE_SIZE / sizeof(gid_t)))
> struct group_info {
>         int ngroups;
>         atomic_t usage;
>         gid_t small_block[NGROUPS_SMALL];
>         int nblocks;
>         gid_t *blocks[0];
> };

> So, it appears to hold 32 gids, but what is this blocks bit?  Is 32 the max
>   number of groups one can be a member of?

By default, every task has enough room for 32 gids.  If you need more than
32, it uses a dynamically allocated 2-d array, stored in blocks.  Always
use the GROUP_AT() macro, and you can treat it like a 1-d array.  I think
there is a hardlimit of 64k groups, but that is simply a #define that can
be changed.  You can have as many groups as you need, dynamically
allocated per-task, with CoW between tasks.  Sorted and bsearch()ed.

      reply	other threads:[~2004-10-28 18:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-28 18:02 Max groups one can be a member of linux/sched.h and NGROUPS_SMALL Joseph Pingenot
2004-10-28 18:21 ` Tim Hockin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041028182109.GA29258@hockin.org \
    --to=thockin@hockin.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.