* [PATCH] prctl: return timerslack through pointer
@ 2009-12-18 0:17 Smith, GeoffX
2009-12-22 21:50 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Smith, GeoffX @ 2009-12-18 0:17 UTC (permalink / raw)
To: linux-kernel@vger.kernel.org
This patch fixes the semantics of prctl() option PR_GET_TIMERSLACK
to pass the return value through *arg2.
With this change, the option now follows the same conventions as the
other "get" options added since 2.6.0, and also brings it into
conformance with the advice in chapter 16 of Documentation/CodingStyle.
In addition, it effectively doubles the range of time slack to 4.29
seconds (on a 32-bit architecture).
The timer slack feature was only added in Sep 2009 (new in 2.6.32.1),
so there are not any production applications to break. I have also
repaired some unmatched signed/unsigned mismatches in timer slack
calculations.
diff --git a/kernel/sys.c b/kernel/sys.c
index 20ccfb5..e01da12 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1531,7 +1531,8 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
error = perf_event_task_enable();
break;
case PR_GET_TIMERSLACK:
- error = current->timer_slack_ns;
+ error = put_user(current->timer_slack_ns,
+ (unsigned long __user *)arg2);
break;
case PR_SET_TIMERSLACK:
if (arg2 <= 0)
diff --git a/fs/select.c b/fs/select.c
index fd38ce2..5122364 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -44,10 +44,10 @@
#define MAX_SLACK (100 * NSEC_PER_MSEC)
-static long __estimate_accuracy(struct timespec *tv)
+static unsigned long __estimate_accuracy(struct timespec *tv)
{
- long slack;
- int divfactor = 1000;
+ unsigned long slack;
+ unsigned int divfactor = 1000;
if (tv->tv_sec < 0)
return 0;
@@ -67,7 +67,7 @@ static long __estimate_accuracy(struct timespec *tv)
return slack;
}
-static long estimate_accuracy(struct timespec *tv)
+static unsigned long estimate_accuracy(struct timespec *tv)
{
unsigned long ret;
struct timespec now;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] prctl: return timerslack through pointer
2009-12-18 0:17 [PATCH] prctl: return timerslack through pointer Smith, GeoffX
@ 2009-12-22 21:50 ` Andrew Morton
2009-12-22 22:05 ` Smith, GeoffX
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2009-12-22 21:50 UTC (permalink / raw)
To: Smith, GeoffX; +Cc: linux-kernel@vger.kernel.org, Arjan van de Ven, stable
On Thu, 17 Dec 2009 16:17:15 -0800
"Smith, GeoffX" <geoffx.smith@intel.com> wrote:
> This patch fixes the semantics of prctl() option PR_GET_TIMERSLACK
> to pass the return value through *arg2.
>
> With this change, the option now follows the same conventions as the
> other "get" options added since 2.6.0, and also brings it into
> conformance with the advice in chapter 16 of Documentation/CodingStyle.
>
> In addition, it effectively doubles the range of time slack to 4.29
> seconds (on a 32-bit architecture).
>
> The timer slack feature was only added in Sep 2009 (new in 2.6.32.1),
> so there are not any production applications to break. I have also
> repaired some unmatched signed/unsigned mismatches in timer slack
> calculations.
>
If we're going to do this then we should backport the patch into
2.6.32.x as well. And I agree that there is time to make this change.
> diff --git a/kernel/sys.c b/kernel/sys.c
> index 20ccfb5..e01da12 100644
You omitted the Signed-off-by: line (described in
Documentation/SubmittingPatches). Please send one.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] prctl: return timerslack through pointer
2009-12-22 21:50 ` Andrew Morton
@ 2009-12-22 22:05 ` Smith, GeoffX
2009-12-22 22:51 ` Smith, GeoffX
0 siblings, 1 reply; 4+ messages in thread
From: Smith, GeoffX @ 2009-12-22 22:05 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel@vger.kernel.org, Arjan van de Ven, stable@kernel.org
Oops, my oversight. In re: any patch I submitted 12/17/2009:
Signed-off-by: Geoff Smith <geoffx.smith@intel.com>
-----Original Message-----
From: Andrew Morton [mailto:akpm@linux-foundation.org]
Sent: Tuesday, December 22, 2009 1:51 PM
To: Smith, GeoffX
Cc: linux-kernel@vger.kernel.org; Arjan van de Ven; stable@kernel.org
Subject: Re: [PATCH] prctl: return timerslack through pointer
On Thu, 17 Dec 2009 16:17:15 -0800
"Smith, GeoffX" <geoffx.smith@intel.com> wrote:
> This patch fixes the semantics of prctl() option PR_GET_TIMERSLACK
> to pass the return value through *arg2.
>
> With this change, the option now follows the same conventions as the
> other "get" options added since 2.6.0, and also brings it into
> conformance with the advice in chapter 16 of Documentation/CodingStyle.
>
> In addition, it effectively doubles the range of time slack to 4.29
> seconds (on a 32-bit architecture).
>
> The timer slack feature was only added in Sep 2009 (new in 2.6.32.1),
> so there are not any production applications to break. I have also
> repaired some unmatched signed/unsigned mismatches in timer slack
> calculations.
>
If we're going to do this then we should backport the patch into
2.6.32.x as well. And I agree that there is time to make this change.
> diff --git a/kernel/sys.c b/kernel/sys.c
> index 20ccfb5..e01da12 100644
You omitted the Signed-off-by: line (described in
Documentation/SubmittingPatches). Please send one.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] prctl: return timerslack through pointer
2009-12-22 22:05 ` Smith, GeoffX
@ 2009-12-22 22:51 ` Smith, GeoffX
0 siblings, 0 replies; 4+ messages in thread
From: Smith, GeoffX @ 2009-12-22 22:51 UTC (permalink / raw)
To: Smith, GeoffX, Andrew Morton
Cc: linux-kernel@vger.kernel.org, Arjan van de Ven, stable@kernel.org
On December 22, Andrew Morton <akpm@linux-foundation.org> wrote:
> To: Smith, GeoffX
> Cc: linux-kernel@vger.kernel.org; Arjan van de Ven; stable@kernel.org
> Subject: Re: [PATCH] prctl: return timerslack through pointer
>
> On Thu, 17 Dec 2009 16:17:15 -0800
> "Smith, GeoffX" <geoffx.smith@intel.com> wrote:
>
>> This patch fixes the semantics of prctl() option PR_GET_TIMERSLACK
>> to pass the return value through *arg2....
>
> If we're going to do this then we should backport the patch into
> 2.6.32.x as well. And I agree that there is time to make this change.
The patch applies cleanly to 2.6.32.2 as well as to the mainline.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-22 22:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-18 0:17 [PATCH] prctl: return timerslack through pointer Smith, GeoffX
2009-12-22 21:50 ` Andrew Morton
2009-12-22 22:05 ` Smith, GeoffX
2009-12-22 22:51 ` Smith, GeoffX
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.