2009-07-27 17:16:18

by Gregory Haskins

[permalink] [raw]
Subject: [regression] sched_getaffinity fails with EINVAL in 2.6.31-rc4

I am not sure when this started, but noticed that sched_getaffinity is
not working in -rc4.

[pid 6254] sched_getaffinity(0, 128, 0x7f80586b1fe0) = -1 EINVAL
(Invalid argument)

Here is a simple program for reproduction:

#include <sched.h>

int main(void)
{
cpu_set_t mask;
int ret;

ret = sched_getaffinity(0, sizeof(mask), &mask);
if (ret < 0)
perror("getaffinity");

return ret;
}

If I get time, I will bisect this later today.

Regards,
-Greg


Attachments:
signature.asc (267.00 B)
OpenPGP digital signature

2009-07-27 17:35:29

by Steven Rostedt

[permalink] [raw]
Subject: Re: [regression] sched_getaffinity fails with EINVAL in 2.6.31-rc4



On Mon, 27 Jul 2009, Gregory Haskins wrote:

> I am not sure when this started, but noticed that sched_getaffinity is
> not working in -rc4.
>
> [pid 6254] sched_getaffinity(0, 128, 0x7f80586b1fe0) = -1 EINVAL
> (Invalid argument)
>
> Here is a simple program for reproduction:

Thanks,

I have a box available in which I can look at this further.

-- Steve

>
> #include <sched.h>
>
> int main(void)
> {
> cpu_set_t mask;
> int ret;
>
> ret = sched_getaffinity(0, sizeof(mask), &mask);
> if (ret < 0)
> perror("getaffinity");
>
> return ret;
> }
>
> If I get time, I will bisect this later today.
>
> Regards,
> -Greg
>
>

2009-07-27 18:12:26

by David Rientjes

[permalink] [raw]
Subject: Re: [regression] sched_getaffinity fails with EINVAL in 2.6.31-rc4

On Mon, 27 Jul 2009, Gregory Haskins wrote:

> I am not sure when this started, but noticed that sched_getaffinity is
> not working in -rc4.
>
> [pid 6254] sched_getaffinity(0, 128, 0x7f80586b1fe0) = -1 EINVAL
> (Invalid argument)
>
> Here is a simple program for reproduction:
>
> #include <sched.h>
>
> int main(void)
> {
> cpu_set_t mask;
> int ret;
>
> ret = sched_getaffinity(0, sizeof(mask), &mask);
> if (ret < 0)
> perror("getaffinity");
>
> return ret;
> }
>
> If I get time, I will bisect this later today.
>

It's most likely due to the cpumask changes. I don't know what cpu_set_t
is, but it's probably smaller than CONFIG_NR_CPUS rounded up to a multiple
of sizeof(long).

2009-07-29 01:49:00

by Rusty Russell

[permalink] [raw]
Subject: Re: [regression] sched_getaffinity fails with EINVAL in 2.6.31-rc4

On Tue, 28 Jul 2009 03:42:15 am David Rientjes wrote:
> On Mon, 27 Jul 2009, Gregory Haskins wrote:
>
> > I am not sure when this started, but noticed that sched_getaffinity is
> > not working in -rc4.
> >
> > [pid 6254] sched_getaffinity(0, 128, 0x7f80586b1fe0) = -1 EINVAL
> > (Invalid argument)
> >
> > Here is a simple program for reproduction:
> >
> > #include <sched.h>
> >
> > int main(void)
> > {
> > cpu_set_t mask;
> > int ret;
> >
> > ret = sched_getaffinity(0, sizeof(mask), &mask);
> > if (ret < 0)
> > perror("getaffinity");
> >
> > return ret;
> > }
> >
> > If I get time, I will bisect this later today.
> >
>
> It's most likely due to the cpumask changes. I don't know what cpu_set_t
> is, but it's probably smaller than CONFIG_NR_CPUS rounded up to a multiple
> of sizeof(long).

It's simply that you finally ran this on a kernel which had
CONFIG_NR_CPUS > 1024.

I argued strongly against the set and getaffinity interfaces when they were
introduced; they can't be used in general without a loop (enlarge cpu_set,
retry).

Cheers,
Rusty.

2009-07-29 03:31:08

by David Rientjes

[permalink] [raw]
Subject: Re: [regression] sched_getaffinity fails with EINVAL in 2.6.31-rc4

On Wed, 29 Jul 2009, Rusty Russell wrote:

> I argued strongly against the set and getaffinity interfaces when they were
> introduced; they can't be used in general without a loop (enlarge cpu_set,
> retry).
>

Right, so the functional regression here is glibc 2.3.2 -> 2.3.3.

2009-07-29 03:48:59

by Gregory Haskins

[permalink] [raw]
Subject: Re: [regression] sched_getaffinity fails with EINVAL in 2.6.31-rc4

Rusty Russell wrote:
> On Tue, 28 Jul 2009 03:42:15 am David Rientjes wrote:
>> On Mon, 27 Jul 2009, Gregory Haskins wrote:
>>
>>> I am not sure when this started, but noticed that sched_getaffinity is
>>> not working in -rc4.
>>>
>>> [pid 6254] sched_getaffinity(0, 128, 0x7f80586b1fe0) = -1 EINVAL
>>> (Invalid argument)
>>>
>>> Here is a simple program for reproduction:
>>>
>>> #include <sched.h>
>>>
>>> int main(void)
>>> {
>>> cpu_set_t mask;
>>> int ret;
>>>
>>> ret = sched_getaffinity(0, sizeof(mask), &mask);
>>> if (ret < 0)
>>> perror("getaffinity");
>>>
>>> return ret;
>>> }
>>>
>>> If I get time, I will bisect this later today.
>>>
>> It's most likely due to the cpumask changes. I don't know what cpu_set_t
>> is, but it's probably smaller than CONFIG_NR_CPUS rounded up to a multiple
>> of sizeof(long).
>
> It's simply that you finally ran this on a kernel which had
> CONFIG_NR_CPUS > 1024.

Indeed. I thought I had replied to the list that I figured that out,
but I think it might have been a trimmed list from someone elses reply.

Long story short, MAXSMP=y crept in, which set NR_CPUS=4096. Backing
this off < 1024 indeed fixes the issue.

Thanks to all who replied!
-Greg


Attachments:
signature.asc (267.00 B)
OpenPGP digital signature