From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Rakib Mullick <rakib.mullick@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, Christoph Lameter <cl@linux.com>,
Mel Gorman <mel@csn.ul.ie>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Subject: Re: [PATCH] mm, vmstat: Use cond_resched only when !CONFIG_PREEMPT
Date: Tue, 31 May 2011 13:29:50 +0900 [thread overview]
Message-ID: <20110531132950.258cd16d.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <BANLkTiksAjyCBAPdCB58tAWhXcdqXM4EcA@mail.gmail.com>
On Tue, 31 May 2011 09:58:40 +0600
Rakib Mullick <rakib.mullick@gmail.com> wrote:
> On Tue, May 31, 2011 at 9:18 AM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > On Tue, 31 May 2011 09:13:47 +0600
> > Rakib Mullick <rakib.mullick@gmail.com> wrote:
> >
> >> 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:
> >> A A A A "Adding a cond_resched() to allow other threads to run in the
> >> non-preemptive
> >> A A 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@kvack.org. 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@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-05-31 4:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-30 16:59 Rakib Mullick
2011-05-30 23:38 ` KAMEZAWA Hiroyuki
2011-05-31 3:13 ` Rakib Mullick
2011-05-31 3:18 ` KAMEZAWA Hiroyuki
2011-05-31 3:58 ` Rakib Mullick
2011-05-31 4:29 ` KAMEZAWA Hiroyuki [this message]
2011-05-31 2:23 ` KOSAKI Motohiro
2011-05-31 3:19 ` Rakib Mullick
2011-05-31 5:55 ` Minchan Kim
2011-05-31 5:57 ` Minchan Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110531132950.258cd16d.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=rakib.mullick@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox