* [PATCH] sched: sched_getaffinity() allow less than NR_CPUS length
@ 2010-03-12 7:15 KOSAKI Motohiro
2010-03-12 16:08 ` Ulrich Drepper
2010-03-15 7:43 ` [tip:sched/urgent] sched: sched_getaffinity(): Allow " tip-bot for KOSAKI Motohiro
0 siblings, 2 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2010-03-12 7:15 UTC (permalink / raw)
To: Sharyathi Nagesh, Ulrich Drepper, Thomas Gleixner, Peter Zijlstra,
Ingo Molnar, LKML
Cc: kosaki.motohiro
Recently, some distro decided to use NR_CPUS=4096 for mysterious reason.
Unfortunately, glibc sched interface have following definition.
# define __CPU_SETSIZE 1024
# define __NCPUBITS (8 * sizeof (__cpu_mask))
typedef unsigned long int __cpu_mask;
typedef struct
{
__cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
} cpu_set_t;
It mean, if NR_CPUS is bigger than 1024, cpu_set_t can makes ABI issue.
More recently, Sharyathi Nagesh reported following test program makes
misterious syscall failure.
-----------------------------------------------------------------------
#define _GNU_SOURCE
#include<stdio.h>
#include<errno.h>
#include<sched.h>
int main()
{
cpu_set_t set;
if (sched_getaffinity(0, sizeof(cpu_set_t), &set) < 0)
printf("\n Call is failing with:%d", errno);
}
-----------------------------------------------------------------------
Because the kernel assue len argument of sched_getaffinity() is bigger
than NR_CPUS. but now it is not correct.
Now we faced annoying dilemma.
(1) if we change glibc's __CPU_SETSIZE definition, we lost
binary compatibility of _all_ application.
(2) if we don't change it, we also lost binary compatibility of
Sharyathi's use case.
Then, I would propse to change the rule of the len argument of
sched_getaffinity().
Old:
len should be bigger than NR_CPUS
New:
len should be bigger than maximum possible cpu id
It makes following behavior
(A) In the real 4096 cpus machine, the above test program still return -EINVAL.
(B) NR_CPUS=4096 but the machine have less than 1024 cpus (almost
machines in the world), the above can run successfully.
Fortunatelly, BIG SGI machine is mainly used for HPC use case. It mean
they can rewrite their program by themself. IOW we can think
they don't annoy this issue.
Reported-by: Sharyathi Nagesh <sharyath@in.ibm.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
kernel/sched.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 150b698..34217f1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4902,7 +4902,9 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
int ret;
cpumask_var_t mask;
- if (len < cpumask_size())
+ if (len < nr_cpu_ids)
+ return -EINVAL;
+ if (len & (sizeof(unsigned long)-1))
return -EINVAL;
if (!alloc_cpumask_var(&mask, GFP_KERNEL))
@@ -4910,10 +4912,12 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
ret = sched_getaffinity(pid, mask);
if (ret == 0) {
- if (copy_to_user(user_mask_ptr, mask, cpumask_size()))
+ int retlen = min(len, cpumask_size());
+
+ if (copy_to_user(user_mask_ptr, mask, retlen))
ret = -EFAULT;
else
- ret = cpumask_size();
+ ret = retlen;
}
free_cpumask_var(mask);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] sched: sched_getaffinity() allow less than NR_CPUS length
2010-03-12 7:15 [PATCH] sched: sched_getaffinity() allow less than NR_CPUS length KOSAKI Motohiro
@ 2010-03-12 16:08 ` Ulrich Drepper
2010-03-15 7:43 ` [tip:sched/urgent] sched: sched_getaffinity(): Allow " tip-bot for KOSAKI Motohiro
1 sibling, 0 replies; 8+ messages in thread
From: Ulrich Drepper @ 2010-03-12 16:08 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: Sharyathi Nagesh, Thomas Gleixner, Peter Zijlstra, Ingo Molnar,
LKML
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/11/2010 11:15 PM, KOSAKI Motohiro wrote:
> Reported-by: Sharyathi Nagesh <sharyath@in.ibm.com>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Cc: Ulrich Drepper <drepper@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@elte.hu>
> ---
> kernel/sched.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
If this isn't creating problems with hotplug CPUs:
Acked-by: Ulrich Drepper <drepper@redhat.com>
- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAkuaZukACgkQ2ijCOnn/RHRu9ACeNyLYw8q4ltCKxVOZme2at4tm
6DwAoJ6wz/weZnO5T3GJag/XsnfytCTu
=k2Dv
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 8+ messages in thread
* [tip:sched/urgent] sched: sched_getaffinity(): Allow less than NR_CPUS length
2010-03-12 7:15 [PATCH] sched: sched_getaffinity() allow less than NR_CPUS length KOSAKI Motohiro
2010-03-12 16:08 ` Ulrich Drepper
@ 2010-03-15 7:43 ` tip-bot for KOSAKI Motohiro
2010-03-15 16:04 ` Jack Steiner
2010-03-16 17:10 ` Ingo Molnar
1 sibling, 2 replies; 8+ messages in thread
From: tip-bot for KOSAKI Motohiro @ 2010-03-15 7:43 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, travis, torvalds, peterz, rja, sharyath,
drepper, steiner, akpm, tglx, kosaki.motohiro, mingo
Commit-ID: cd3d8031eb4311e516329aee03c79a08333141f1
Gitweb: http://git.kernel.org/tip/cd3d8031eb4311e516329aee03c79a08333141f1
Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
AuthorDate: Fri, 12 Mar 2010 16:15:36 +0900
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 15 Mar 2010 08:28:44 +0100
sched: sched_getaffinity(): Allow less than NR_CPUS length
[ Note, this commit changes the syscall ABI for > 1024 CPUs systems. ]
Recently, some distro decided to use NR_CPUS=4096 for mysterious reasons.
Unfortunately, glibc sched interface has the following definition:
# define __CPU_SETSIZE 1024
# define __NCPUBITS (8 * sizeof (__cpu_mask))
typedef unsigned long int __cpu_mask;
typedef struct
{
__cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
} cpu_set_t;
It mean, if NR_CPUS is bigger than 1024, cpu_set_t makes an
ABI issue ...
More recently, Sharyathi Nagesh reported following test program makes
misterious syscall failure:
-----------------------------------------------------------------------
#define _GNU_SOURCE
#include<stdio.h>
#include<errno.h>
#include<sched.h>
int main()
{
cpu_set_t set;
if (sched_getaffinity(0, sizeof(cpu_set_t), &set) < 0)
printf("\n Call is failing with:%d", errno);
}
-----------------------------------------------------------------------
Because the kernel assumes len argument of sched_getaffinity() is bigger
than NR_CPUS. But now it is not correct.
Now we are faced with the following annoying dilemma, due to
the limitations of the glibc interface built in years ago:
(1) if we change glibc's __CPU_SETSIZE definition, we lost
binary compatibility of _all_ application.
(2) if we don't change it, we also lost binary compatibility of
Sharyathi's use case.
Then, I would propse to change the rule of the len argument of
sched_getaffinity().
Old:
len should be bigger than NR_CPUS
New:
len should be bigger than maximum possible cpu id
This creates the following behavior:
(A) In the real 4096 cpus machine, the above test program still
return -EINVAL.
(B) NR_CPUS=4096 but the machine have less than 1024 cpus (almost
all machines in the world), the above can run successfully.
Fortunatelly, BIG SGI machine is mainly used for HPC use case. It means
they can rebuild their programs.
IOW we hope they are not annoyed by this issue ...
Reported-by: Sharyathi Nagesh <sharyath@in.ibm.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Ulrich Drepper <drepper@redhat.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jack Steiner <steiner@sgi.com>
Cc: Russ Anderson <rja@sgi.com>
Cc: Mike Travis <travis@sgi.com>
LKML-Reference: <20100312161316.9520.A69D9226@jp.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/sched.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 9ab3cd7..6eaef3d 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4902,7 +4902,9 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
int ret;
cpumask_var_t mask;
- if (len < cpumask_size())
+ if (len < nr_cpu_ids)
+ return -EINVAL;
+ if (len & (sizeof(unsigned long)-1))
return -EINVAL;
if (!alloc_cpumask_var(&mask, GFP_KERNEL))
@@ -4910,10 +4912,12 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
ret = sched_getaffinity(pid, mask);
if (ret == 0) {
- if (copy_to_user(user_mask_ptr, mask, cpumask_size()))
+ int retlen = min(len, cpumask_size());
+
+ if (copy_to_user(user_mask_ptr, mask, retlen))
ret = -EFAULT;
else
- ret = cpumask_size();
+ ret = retlen;
}
free_cpumask_var(mask);
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [tip:sched/urgent] sched: sched_getaffinity(): Allow less than NR_CPUS length
2010-03-15 7:43 ` [tip:sched/urgent] sched: sched_getaffinity(): Allow " tip-bot for KOSAKI Motohiro
@ 2010-03-15 16:04 ` Jack Steiner
2010-03-15 16:17 ` Ulrich Drepper
2010-03-16 17:10 ` Ingo Molnar
1 sibling, 1 reply; 8+ messages in thread
From: Jack Steiner @ 2010-03-15 16:04 UTC (permalink / raw)
To: mingo, hpa, linux-kernel, torvalds, travis, peterz, drepper, rja,
sharyath, akpm, tglx, kosaki.motohiro, mingo
Cc: linux-tip-commits
On Mon, Mar 15, 2010 at 07:43:02AM +0000, tip-bot for KOSAKI Motohiro wrote:
> Commit-ID: cd3d8031eb4311e516329aee03c79a08333141f1
> Gitweb: http://git.kernel.org/tip/cd3d8031eb4311e516329aee03c79a08333141f1
> Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> AuthorDate: Fri, 12 Mar 2010 16:15:36 +0900
> Committer: Ingo Molnar <mingo@elte.hu>
> CommitDate: Mon, 15 Mar 2010 08:28:44 +0100
...
> IOW we hope they are not annoyed by this issue ...
The change looks ok but I can't reproduce the problem.
I'm running on a distro kernel that has NR_CPUS=4096. Glibc has also has a
definition of __CPU_SETSIZE (I assume this change was made by the distro but
am not certain):
sched.c
...
#if defined _SCHED_H && !defined __cpu_set_t_defined
# define __cpu_set_t_defined
/* Size definition for CPU sets. */
# define __CPU_SETSIZE 4096
# define __NCPUBITS (8 * sizeof (__cpu_mask))
Your test program runs ok:
% strace t
...
sched_getaffinity(0, 512, { ffff, 0, 0, 0, 0, 0, 0, 0 }) = 64
Also note that we've run on IA64 systems with NR_CPUS=4096 for several years w/o
hitting any problems.
Bottom line. I don't think the change will affect us.
>
> sched: sched_getaffinity(): Allow less than NR_CPUS length
>
> [ Note, this commit changes the syscall ABI for > 1024 CPUs systems. ]
>
> Recently, some distro decided to use NR_CPUS=4096 for mysterious reasons.
> Unfortunately, glibc sched interface has the following definition:
>
> # define __CPU_SETSIZE 1024
> # define __NCPUBITS (8 * sizeof (__cpu_mask))
> typedef unsigned long int __cpu_mask;
> typedef struct
> {
> __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
> } cpu_set_t;
>
> It mean, if NR_CPUS is bigger than 1024, cpu_set_t makes an
> ABI issue ...
>
> More recently, Sharyathi Nagesh reported following test program makes
> misterious syscall failure:
>
> -----------------------------------------------------------------------
> #define _GNU_SOURCE
> #include<stdio.h>
> #include<errno.h>
> #include<sched.h>
>
> int main()
> {
> cpu_set_t set;
> if (sched_getaffinity(0, sizeof(cpu_set_t), &set) < 0)
> printf("\n Call is failing with:%d", errno);
> }
> -----------------------------------------------------------------------
>
> Because the kernel assumes len argument of sched_getaffinity() is bigger
> than NR_CPUS. But now it is not correct.
>
> Now we are faced with the following annoying dilemma, due to
> the limitations of the glibc interface built in years ago:
>
> (1) if we change glibc's __CPU_SETSIZE definition, we lost
> binary compatibility of _all_ application.
>
> (2) if we don't change it, we also lost binary compatibility of
> Sharyathi's use case.
>
> Then, I would propse to change the rule of the len argument of
> sched_getaffinity().
>
> Old:
> len should be bigger than NR_CPUS
> New:
> len should be bigger than maximum possible cpu id
>
> This creates the following behavior:
>
> (A) In the real 4096 cpus machine, the above test program still
> return -EINVAL.
>
> (B) NR_CPUS=4096 but the machine have less than 1024 cpus (almost
> all machines in the world), the above can run successfully.
>
> Fortunatelly, BIG SGI machine is mainly used for HPC use case. It means
> they can rebuild their programs.
>
> IOW we hope they are not annoyed by this issue ...
>
> Reported-by: Sharyathi Nagesh <sharyath@in.ibm.com>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Acked-by: Ulrich Drepper <drepper@redhat.com>
> Acked-by: Peter Zijlstra <peterz@infradead.org>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Jack Steiner <steiner@sgi.com>
> Cc: Russ Anderson <rja@sgi.com>
> Cc: Mike Travis <travis@sgi.com>
> LKML-Reference: <20100312161316.9520.A69D9226@jp.fujitsu.com>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
> kernel/sched.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 9ab3cd7..6eaef3d 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -4902,7 +4902,9 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
> int ret;
> cpumask_var_t mask;
>
> - if (len < cpumask_size())
> + if (len < nr_cpu_ids)
> + return -EINVAL;
> + if (len & (sizeof(unsigned long)-1))
> return -EINVAL;
>
> if (!alloc_cpumask_var(&mask, GFP_KERNEL))
> @@ -4910,10 +4912,12 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
>
> ret = sched_getaffinity(pid, mask);
> if (ret == 0) {
> - if (copy_to_user(user_mask_ptr, mask, cpumask_size()))
> + int retlen = min(len, cpumask_size());
> +
> + if (copy_to_user(user_mask_ptr, mask, retlen))
> ret = -EFAULT;
> else
> - ret = cpumask_size();
> + ret = retlen;
> }
> free_cpumask_var(mask);
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [tip:sched/urgent] sched: sched_getaffinity(): Allow less than NR_CPUS length
2010-03-15 16:04 ` Jack Steiner
@ 2010-03-15 16:17 ` Ulrich Drepper
0 siblings, 0 replies; 8+ messages in thread
From: Ulrich Drepper @ 2010-03-15 16:17 UTC (permalink / raw)
To: Jack Steiner
Cc: mingo, hpa, linux-kernel, torvalds, travis, peterz, rja, sharyath,
akpm, tglx, kosaki.motohiro, mingo, linux-tip-commits
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/15/2010 09:04 AM, Jack Steiner wrote:
> I'm running on a distro kernel that has NR_CPUS=4096. Glibc has also has a
> definition of __CPU_SETSIZE (I assume this change was made by the distro but
> am not certain):
This isn't upstream and it cannot. Whoever make this change doesn't
know what binary compatibility means. The size has always been 1024 bits.
- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkueXYIACgkQ2ijCOnn/RHQJPQCbBvh+Mi7ZrHaQcVxEkglIj+Pz
j7UAoJaBCpD2a5KbAR1VGkM7orp+GBhY
=T78A
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [tip:sched/urgent] sched: sched_getaffinity(): Allow less than NR_CPUS length
2010-03-15 7:43 ` [tip:sched/urgent] sched: sched_getaffinity(): Allow " tip-bot for KOSAKI Motohiro
2010-03-15 16:04 ` Jack Steiner
@ 2010-03-16 17:10 ` Ingo Molnar
2010-03-17 0:36 ` KOSAKI Motohiro
1 sibling, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2010-03-16 17:10 UTC (permalink / raw)
To: mingo, hpa, linux-kernel, torvalds, travis, peterz, drepper, rja,
sharyath, akpm, steiner, tglx, kosaki.motohiro
Cc: linux-tip-commits
* tip-bot for KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> Commit-ID: cd3d8031eb4311e516329aee03c79a08333141f1
> Gitweb: http://git.kernel.org/tip/cd3d8031eb4311e516329aee03c79a08333141f1
> Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> AuthorDate: Fri, 12 Mar 2010 16:15:36 +0900
> Committer: Ingo Molnar <mingo@elte.hu>
> CommitDate: Mon, 15 Mar 2010 08:28:44 +0100
>
> sched: sched_getaffinity(): Allow less than NR_CPUS length
> + int retlen = min(len, cpumask_size());
this one causes:
kernel/sched.c:4850: warning: comparison of distinct pointer types lacks a cast
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [tip:sched/urgent] sched: sched_getaffinity(): Allow less than NR_CPUS length
2010-03-16 17:10 ` Ingo Molnar
@ 2010-03-17 0:36 ` KOSAKI Motohiro
2010-03-17 10:03 ` [tip:sched/urgent] sched: Use proper type in sched_getaffinity() tip-bot for KOSAKI Motohiro
0 siblings, 1 reply; 8+ messages in thread
From: KOSAKI Motohiro @ 2010-03-17 0:36 UTC (permalink / raw)
To: Ingo Molnar
Cc: kosaki.motohiro, mingo, hpa, linux-kernel, torvalds, travis,
peterz, drepper, rja, sharyath, akpm, steiner, tglx,
linux-tip-commits
>
> * tip-bot for KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
>
> > Commit-ID: cd3d8031eb4311e516329aee03c79a08333141f1
> > Gitweb: http://git.kernel.org/tip/cd3d8031eb4311e516329aee03c79a08333141f1
> > Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> > AuthorDate: Fri, 12 Mar 2010 16:15:36 +0900
> > Committer: Ingo Molnar <mingo@elte.hu>
> > CommitDate: Mon, 15 Mar 2010 08:28:44 +0100
> >
> > sched: sched_getaffinity(): Allow less than NR_CPUS length
>
> > + int retlen = min(len, cpumask_size());
>
> this one causes:
>
> kernel/sched.c:4850: warning: comparison of distinct pointer types lacks a cast
Ahh, I'm sorry. attached fixing patch.
thanks.
============================
Subject: [PATCH] fix warning
fix following warning.
kernel/sched.c:4850: warning: comparison of distinct pointer types lacks
a cast
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
kernel/sched.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 34217f1..d1d5acd 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4912,7 +4912,7 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
ret = sched_getaffinity(pid, mask);
if (ret == 0) {
- int retlen = min(len, cpumask_size());
+ size_t retlen = min_t(size_t, len, cpumask_size());
if (copy_to_user(user_mask_ptr, mask, retlen))
ret = -EFAULT;
--
1.6.5.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip:sched/urgent] sched: Use proper type in sched_getaffinity()
2010-03-17 0:36 ` KOSAKI Motohiro
@ 2010-03-17 10:03 ` tip-bot for KOSAKI Motohiro
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for KOSAKI Motohiro @ 2010-03-17 10:03 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, kosaki.motohiro, mingo
Commit-ID: 8bc037fb89bb3104b9ae290d18c877624cd7d9cc
Gitweb: http://git.kernel.org/tip/8bc037fb89bb3104b9ae290d18c877624cd7d9cc
Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
AuthorDate: Wed, 17 Mar 2010 09:36:58 +0900
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 17 Mar 2010 10:48:49 +0100
sched: Use proper type in sched_getaffinity()
Using the proper type fixes the following compiler warning:
kernel/sched.c:4850: warning: comparison of distinct pointer types lacks a cast
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: torvalds@linux-foundation.org
Cc: travis@sgi.com
Cc: peterz@infradead.org
Cc: drepper@redhat.com
Cc: rja@sgi.com
Cc: sharyath@in.ibm.com
Cc: steiner@sgi.com
LKML-Reference: <20100317090046.4C79.A69D9226@jp.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/sched.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 82975b5..49d2fa7 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4912,7 +4912,7 @@ SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
ret = sched_getaffinity(pid, mask);
if (ret == 0) {
- int retlen = min(len, cpumask_size());
+ size_t retlen = min_t(size_t, len, cpumask_size());
if (copy_to_user(user_mask_ptr, mask, retlen))
ret = -EFAULT;
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-03-17 10:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 7:15 [PATCH] sched: sched_getaffinity() allow less than NR_CPUS length KOSAKI Motohiro
2010-03-12 16:08 ` Ulrich Drepper
2010-03-15 7:43 ` [tip:sched/urgent] sched: sched_getaffinity(): Allow " tip-bot for KOSAKI Motohiro
2010-03-15 16:04 ` Jack Steiner
2010-03-15 16:17 ` Ulrich Drepper
2010-03-16 17:10 ` Ingo Molnar
2010-03-17 0:36 ` KOSAKI Motohiro
2010-03-17 10:03 ` [tip:sched/urgent] sched: Use proper type in sched_getaffinity() tip-bot for KOSAKI Motohiro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox