On Tue, 31 May 2011 09:58:40 +0600 Rakib Mullick <rakib.mullick@xxxxxxxxx> wrote: > On Tue, May 31, 2011 at 9:18 AM, KAMEZAWA Hiroyuki > <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote: > > On Tue, 31 May 2011 09:13:47 +0600 > > Rakib Mullick <rakib.mullick@xxxxxxxxx> wrote: > > > >> On Tue, May 31, 2011 at 5:38 AM, KAMEZAWA Hiroyuki > >> <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote: > >> > On Mon, 30 May 2011 22:59:04 +0600 > >> > Rakib Mullick <rakib.mullick@xxxxxxxxx> wrote: > >> > > >> >> 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(). > >> >> > >> >> Signed-off-by: Rakib Mullick <rakib.mullick@xxxxxxxxx> > >> > > >> > 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." > >> > > > > 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. > > > What's bad with all cond_resched() in the kernel as no-op in CONFIG_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, 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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx 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:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>