lkml.org 
[lkml]   [2011]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] mm, vmstat: Use cond_resched only when !CONFIG_PREEMPT
From
On Tue, May 31, 2011 at 5:38 AM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Mon, 30 May 2011 22:59:04 +0600
> Rakib Mullick <rakib.mullick@gmail.com> 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@gmail.com>
>
> 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

> Thanks,
> -Kame
>
>> ---
>>
>> diff --git a/mm/vmstat.c b/mm/vmstat.c
>> index 20c18b7..72cf857 100644
>> --- a/mm/vmstat.c
>> +++ b/mm/vmstat.c
>> @@ -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
>>
>>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-05-31 05:15    [W:0.040 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site