Source-Changes archive

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

Re: CVS commit: src



> yamt%mwd.biglobe.ne.jp@localhost (YAMAMOTO Takashi) wrote:
> > > > > - Why? Note, that we pass the size of the structure.
> > > > 
> > > > are you asking why i think exporting MAXCPUS is a bad idea?
> > > > 
> > > > > - Do you have a better suggestion?
> > > > 
> > > > remove the knowledge of MAXCPUS from userland.
> > > 
> > > We depend on MAXCPUS only in kernel, since we use size in userland. Do you
> > > want to hide it from userland, or replace cpuset_t dependence to MAXCPUS
> > > in general?
> > 
> > actually, at least schedctl seems to depend on MAXCPUS.
> > besides, _sched_setaffinity and _sched_getaffinity silently truncates a
> > bitmap. it's fine to use it in kernel internally, but not a part of the
> > userland abi.
> > 
> > > Modification to use some static size would not be very comfortable..
> > 
> > i'm not sure what you mean here.
> > you hardcoded a static size (MAXCPUS), which is what i'm not happy with.
> 
> Sorry for late reply, let's figure out this. My points was:
> - Since MAXCPUS can only be increased, ABI would not be broken;

MAXCPUS can only be increased?  why?

anyway it depends on what do you mean by "ABI would not be broken".
old schedctl binaries might not crash.  however they can't handle
the increased MAXCPUS properly.

> - MAXCPUS is used to calculate CPUSET_SIZE only;
>   I have removed it from schedctl(8);

cpuset_t is:

        typedef struct {
                uint32_t        bits[CPUSET_SIZE];
        } cpuset_t;

so sizeof(cpuset_t), which is hardcoded in schedctl.c,
is CPUSET_SIZE dependent.

> - Why silent truncation is wrong in this case?

each truncated bits can be either 0 or 1.
how can you know which was intended?

> Are you suggesting CPUSET_SIZE to not depend on MAXCPUS?

i'm suggesting to make it dynamic at least for userland programs.

- syscalls should not truncate bitmaps silently.  they should return
  appropriate errors.

- userland should not assume the size of cpuset_t.
  there should be a way for userland to query the bitmap size
  for "get" syscalls.  (probably like getsockopt)

YAMAMOTO Takashi

> 
> -- 
> Best regards,
> Mindaugas
> www.NetBSD.org



Home | Main Index | Thread Index | Old Index