Hi All,
From the patch it seems that it modifies the system call "ptctl".
So I guess this system call modifies the behavior of the child process.
From the patch:
@@ -1917,12 +1918,10 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
error = current->timer_slack_ns;
break;
case PR_SET_TIMERSLACK:
- if (arg2 <= 0)
- current->timer_slack_ns =
- current->default_timer_slack_ns;
- else
+ if (arg2 <= HRTIMER_MAX_SLACK)
current->timer_slack_ns = arg2;
- error = 0;
+ else
+ error = -EINVAL;
error = current->timer_slack_ns;
break;
case PR_SET_TIMERSLACK:
- if (arg2 <= 0)
- current->timer_slack_ns =
- current->default_timer_slack_ns;
- else
+ if (arg2 <= HRTIMER_MAX_SLACK)
current->timer_slack_ns = arg2;
- error = 0;
+ else
+ error = -EINVAL;
And From the patch describing:
"This patch proposes a system-wide sysctl-aware default for the
high-resolution timer slack value, which may be changed from 0
to HRTIMER_MAX_SLACK nanoseconds. Default system-wide and per-task
values are HRTIMER_DEFAULT_SLACK. Per-task value isn't inherited
across fork(); instead, newborn task uses system-wide value by
default, and newborn thread uses it's group leader value."
high-resolution timer slack value, which may be changed from 0
to HRTIMER_MAX_SLACK nanoseconds. Default system-wide and per-task
values are HRTIMER_DEFAULT_SLACK. Per-task value isn't inherited
across fork(); instead, newborn task uses system-wide value by
default, and newborn thread uses it's group leader value."
So the second argument to this system call can set the new Time slack value for the child process
this value can also be set from the sysctl command.
Here is the example from Linux Test Project (ltp)
$ltp/testcases/kernel/syscalls/prctl/prctl02.c
switch (child_pid = FORK_OR_VFORK()) {
case
-1:
/* fork() failed */
tst_resm(TFAIL, "fork() failed");
continue;
/* fork() failed */
tst_resm(TFAIL, "fork() failed");
continue;
case
0:
/* Child */
/* Child */
TEST(prctl(test_cases[i].option,
test_cases[i].arg2));
if ((TEST_RETURN == -1) && (TEST_ERRNO ==
test_cases[i].
exp_errno)) {
exit(TEST_ERRNO);
} else {
tst_resm(TWARN|TTERRNO, "prctl() returned %ld",
TEST_RETURN);
exit(TEST_ERRNO);
}
test_cases[i].arg2));
if ((TEST_RETURN == -1) && (TEST_ERRNO ==
test_cases[i].
exp_errno)) {
exit(TEST_ERRNO);
} else {
tst_resm(TWARN|TTERRNO, "prctl() returned %ld",
TEST_RETURN);
exit(TEST_ERRNO);
}
I guess this is the correct example for this.
Please correct
me if I am wrong.
-Anand Moon
From: trisha yad <trisha1march@xxxxxxxxx>
To: naveen yadav <yad.naveen@xxxxxxxxx>
Cc: Daniel Baluta <daniel.baluta@xxxxxxxxx>; Kernelnewbies@xxxxxxxxxxxxxxxxx
Sent: Monday, March 5, 2012 4:14 PM
Subject: Re: slacks usage,..
To: naveen yadav <yad.naveen@xxxxxxxxx>
Cc: Daniel Baluta <daniel.baluta@xxxxxxxxx>; Kernelnewbies@xxxxxxxxxxxxxxxxx
Sent: Monday, March 5, 2012 4:14 PM
Subject: Re: slacks usage,..
Thanks a lot.
On Mon, Mar 5, 2012 at 4:11 PM, naveen yadav <yad.naveen@xxxxxxxxx> wrote:
> Thanks Daniel, I got it ^^.
>
>
> On Mon, Mar 5, 2012 at 2:52 PM, Daniel Baluta <daniel.baluta@xxxxxxxxx> wrote:
>> On Mon, Mar 5, 2012 at 11:00 AM, trisha yad <trisha1march@xxxxxxxxx> wrote:
>>> Hi All,
>>>
>>> I am going through below topic http://patches.linaro.org/6833/. I
>>> could not got the meaning of slacks. Why I need this ..
>>> Is there some real example of need of slacks.
>>
>> Have you tried searching for it? :D [1].
>>
>> thanks,
>> Daniel.
>>
>> [1] https://lwn.net/Articles/369549/
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies@xxxxxxxxxxxxxxxxx
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies