mm, vmstat: Use cond_resched only when !CONFIG_PREEMPT
Subsystems (2)
PATCH 1/1 mm, vmstat: Use cond_resched only when !CONFIG_PREEMPT
commit 468fd62ed9 (vmstats: add cond_resched() to refresh_cpu_vm_stats()) added cond_resched() in refresh_cpu_vm_stats. Purpose of that patch was to allow other threads to run in non-preemptive case. This patch, makes sure that cond_resched() gets called when !CONFIG_PREEMPT is set. In a preemptiable kernel we don't need to call cond_resched().
---
mm/vmstat.c +4 -0
@@ -461,7 +461,11 @@ void refresh_cpu_vm_stats(int cpu) p->expire =3 ;#endif } + +#ifndef CONFIG_PREEMPT cond_resched (); +#endif +#ifdef CONFIG_NUMA /* * Deal with draining the remote pageset of this
Quoted 3 lines · On Mon, 30 May 2011 22:59:04 +0600 Rakib Mullick <[email protected]>…
commit
468fd62ed9(vmstats: addcond_resched()torefresh_cpu_vm_stats()) addedcond_resched()inrefresh_cpu_vm_stats. Purpose of that patch was to allow other threads to run in non-preemptive case. This patch, makes sure thatcond_resched()gets called when !CONFIG_PREEMPT is set. In a preemptiable kernel we don't need to callcond_resched().Signed-off-by Rakib Mullick <[email protected]>
Hmm, what benefit do we get by adding this extra #ifdef in the code directly ? Other cond_resched() callers are not guilty in !CONFIG_PREEMPT ?
Thanks,
-Kame
Quoted 10 lines
---
mm/vmstat.c +0
-0@@ -461,7 +461,11 @@ void refresh_cpu_vm_stats(int cpu) p->expire =3 ;
mm/vmstat.c void refresh_cpu_vm_stats(int cpu) · line 471
Quoted 10 lines
mm/vmstat.c +4
-0#endif } + +#ifndef CONFIG_PREEMPT cond_resched (); +#endif +#ifdef CONFIG_NUMA /* * Deal with draining the remote pageset of this
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · KAMEZAWA Hiroyuki
Quoted 3 lines · On Mon, 30 May 2011 22:59:04 +0600 Rakib Mullick <[email protected]>…
commit
468fd62ed9(vmstats: addcond_resched()torefresh_cpu_vm_stats()) addedcond_resched()inrefresh_cpu_vm_stats. Purpose of that patch was to allow other threads to run in non-preemptive case. This patch, makes sure thatcond_resched()gets called when !CONFIG_PREEMPT is set. In a preemptiable kernel we don't need to callcond_resched().Signed-off-by Rakib Mullick <[email protected]>Hmm, what benefit do we get by adding this extra #ifdef in the code directly ? Other
cond_resched()callers are not guilty in !CONFIG_PREEMPT ?
Well, in preemptible kernel this context will get preempted if requires, so we don't need cond_resched(). If you checkout the git log of the mentioned commit, you'll find the explanation. It says:
"Adding a cond_resched() to allow other threads to run in the
non-preemptive
case."
So, let cond_resched() be in non-preemptive case.
Thanks,
Rakib
Quoted 25 lines
Thanks,
-KameQuoted 20 lines
---
mm/vmstat.c +4
-0@@ -461,7 +461,11 @@ void refresh_cpu_vm_stats(int cpu) p->expire = 3; #endif } + +#ifndef CONFIG_PREEMPT cond_resched(); +#endif + #ifdef CONFIG_NUMA /** Deal with draining the remote pageset of this
Quoted 12 lines · On Tue, 31 May 2011 09:13:47 +0600 Rakib Mullick <[email protected]>…
Quoted 10 lines · KAMEZAWA Hiroyuki
Quoted 3 lines · On Mon, 30 May 2011 22:59:04 +0600 Rakib Mullick <[email protected]>…
commit
468fd62ed9(vmstats: addcond_resched()torefresh_cpu_vm_stats()) addedcond_resched()inrefresh_cpu_vm_stats. Purpose of that patch was to allow other threads to run in non-preemptive case. This patch, makes sure thatcond_resched()gets called when !CONFIG_PREEMPT is set. In a preemptiable kernel we don't need to callcond_resched().Signed-off-by Rakib Mullick <[email protected]>Hmm, what benefit do we get by adding this extra #ifdef in the code directly ? Other
cond_resched()callers are not guilty in !CONFIG_PREEMPT ?
Quoted 7 lines
Well, in preemptible kernel this context will get preempted if requires, so we don't need
cond_resched(). If you checkout the git log of the mentioned commit, you'll find the explanation. It says:
"Adding acond_resched()to allow other threads to run in the
non-preemptivecase."
IOW, my question is "why only this cond_resched() should be fixed ?" What's bad with all cond_resched() in the kernel as no-op in CONFIG_PREEMPT ?
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 23 lines · KAMEZAWA Hiroyuki
Quoted 12 lines · On Tue, 31 May 2011 09:13:47 +0600 Rakib Mullick <[email protected]>…
Quoted 10 lines · KAMEZAWA Hiroyuki
Quoted 3 lines · On Mon, 30 May 2011 22:59:04 +0600 Rakib Mullick <[email protected]>…
commit
468fd62ed9(vmstats: addcond_resched()torefresh_cpu_vm_stats()) addedcond_resched()inrefresh_cpu_vm_stats. Purpose of that patch was to allow other threads to run in non-preemptive case. This patch, makes sure thatcond_resched()gets called when !CONFIG_PREEMPT is set. In a preemptiable kernel we don't need to callcond_resched().Signed-off-by Rakib Mullick <[email protected]>Hmm, what benefit do we get by adding this extra #ifdef in the code directly ? Other
cond_resched()callers are not guilty in !CONFIG_PREEMPT ?Quoted 7 lines
Well, in preemptible kernel this context will get preempted if requires, so we don't need
cond_resched(). If you checkout the git log of the mentioned commit, you'll find the explanation. It says:
"Adding acond_resched()to allow other threads to run in the non-preemptive
case."
Quoted 1 line
IOW, my question is "why only this
cond_resched()should be fixed ?"
cond_resched() forces this thread to be scheduled. I'm just trying pointing out the use of cond_resched(), until unless I'm not missing anything.
Quoted 2 lines
What's bad with all
cond_resched()in the kernel as no-op inCONFIG_PREEMPT?
cond_resched() basically checks whether it needs to be scheduled or not. But, we know in advance that we don't need cond_resched in CONFIG_PREEMPT.
Thanks,
Rakib
Quoted 5 lines
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 31 lines · On Tue, 31 May 2011 09:58:40 +0600 Rakib Mullick <[email protected]>…
Quoted 23 lines · KAMEZAWA Hiroyuki
Quoted 12 lines · On Tue, 31 May 2011 09:13:47 +0600 Rakib Mullick <[email protected]>…
Quoted 10 lines · KAMEZAWA Hiroyuki
Quoted 3 lines · On Mon, 30 May 2011 22:59:04 +0600 Rakib Mullick <[email protected]>…
commit
468fd62ed9(vmstats: addcond_resched()torefresh_cpu_vm_stats()) addedcond_resched()inrefresh_cpu_vm_stats. Purpose of that patch was to allow other threads to run in non-preemptive case. This patch, makes sure thatcond_resched()gets called when !CONFIG_PREEMPT is set. In a preemptiable kernel we don't need to callcond_resched().Signed-off-by Rakib Mullick <[email protected]>Hmm, what benefit do we get by adding this extra #ifdef in the code directly ? Other
cond_resched()callers are not guilty in !CONFIG_PREEMPT ?Quoted 7 lines
Well, in preemptible kernel this context will get preempted if requires, so we don't need
cond_resched(). If you checkout the git log of the mentioned commit, you'll find the explanation. It says:
"Adding acond_resched()to allow other threads to run in the non-preemptive
case."Quoted 1 line
IOW, my question is "why only this
cond_resched()should be fixed ?"
cond_resched()forces this thread to be scheduled. I'm just trying pointing out the use ofcond_resched(), until unless I'm not missing anything.
Quoted 7 lines
Quoted 2 lines
What's bad with all
cond_resched()in the kernel as no-op inCONFIG_PREEMPT?
cond_resched()basically checks whether it needs to be scheduled or not. But, we know in advance that we don't needcond_reschedinCONFIG_PREEMPT.Thanks,
Then just remove _all_ cond_resched() by defining noop function in header. Please don't fix in ugly way.
#ifdef CONFIG_PEERMPT
static void cond_resched()
{
}
#endif
Thanks,
-Kame
mm/vmstat.c void refresh_cpu_vm_stats(int cpu) · line 468
Quoted 13 lines
mm/vmstat.c +4
-0@@ -461,7 +461,11 @@ void refresh_cpu_vm_stats(int cpu) p->expire =3 ;#endif } + +#ifndef CONFIG_PREEMPT cond_resched (); +#endif +
In general, we should avoid #ifdef CONFIG_PREEMPT for maintainancebility as far as possible. Is there any observable benefit? Can you please demonstrate it?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · KOSAKI Motohiro
Quoted 8 lines
mm/vmstat.c +0
-0@@ -461,7 +461,11 @@ void refresh_cpu_vm_stats(int cpu) p->expire = 3; #endif }
Quoted 9 lines
mm/vmstat.c void refresh_cpu_vm_stats(int cpu) · line 468
Quoted 5 lines
mm/vmstat.c +4
-0+ +#ifndef CONFIG_PREEMPT cond_resched(); +#endif +In general, we should avoid #ifdef
CONFIG_PREEMPTfor maintainancebility as far as possible. Is there any observable benefit? Can you please demonstrate it?
On my system I'm not sure whether it shows demonstratable benefit or not. Although, I try. It will be helpful if you give me a hint about how to measure its benefit.
Thanks,
Rakib
Quoted 3 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Rakib Mullick
commit
468fd62ed9(vmstats: addcond_resched()torefresh_cpu_vm_stats()) addedcond_resched()inrefresh_cpu_vm_stats. Purpose of that patch was to allow other threads to run in non-preemptive case. This patch, makes sure thatcond_resched()gets called when !CONFIG_PREEMPT is set. In a preemptiable kernel we don't need to callcond_resched().Signed-off-by Rakib Mullick <[email protected]>
Let me ask questions.
1. What's bad if we call cond_resched on CONFIG_PREEMPT?
Is refresh_cpu_vm_stats a hot path?
2. There is no help to call explicit scheduling point on CONFIG_PREEMPTION?
We used cond_resched without any ifdef/endif of CONFIG_PREEMPT.
In addtion, cond_resched includes __might_sleep which is debugging help for lock. So I hope let it be if you have a big concern.
Signature · 9 lines
Kind regards Meinchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 7 lines · Minchan Kim
Quoted 3 lines · Rakib Mullick
commit
468fd62ed9(vmstats: addcond_resched()torefresh_cpu_vm_stats()) addedcond_resched()inrefresh_cpu_vm_stats. Purpose of that patch was to allow other threads to run in non-preemptive case. This patch, makes sure thatcond_resched()gets called when !CONFIG_PREEMPT is set. In a preemptiable kernel we don't need to callcond_resched().Signed-off-by Rakib Mullick <[email protected]>Let me ask questions.
Quoted 7 lines
1. What's bad if we call
cond_reschedonCONFIG_PREEMPT?
Isrefresh_cpu_vm_statsa hot path?
2. There is no help to call explicit scheduling point onCONFIG_PREEMPTION?We used
cond_reschedwithout any ifdef/endif ofCONFIG_PREEMPT.
In addtion,cond_reschedincludes__might_sleepwhich is debugging help for lock. So I hope let it be if you have a big concern.
typo ^^
unless
Signature · 9 lines
Kind regards Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>