[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [dm-devel] [PATCH] dm-bufio
- From: Joe Thornber <thornber redhat com>
- To: Mikulas Patocka <mpatocka redhat com>
- Cc: dm-devel redhat com, Mike Snitzer <msnitzer redhat com>, "Alasdair G. Kergon" <agk redhat com>
- Subject: Re: [dm-devel] [PATCH] dm-bufio
- Date: Mon, 17 Oct 2011 15:15:22 +0100
On Mon, Oct 17, 2011 at 10:04:16AM -0400, Mikulas Patocka wrote:
> > If you're going to use cond_resched() at least do so a little more
> > intelligently than putting it in _every_ loop. For instance you call it on
> > every iteration of a sweep through the hash table. The call to
> > cond_resched will take more time than the loop body. At least make a
> > change so it's only done every n'th iteration.
>
> I think it would be better to use
> #ifndef CONFIG_PREEMPT
> if (need_resched()) cond_resched();
> #endif
>
> need_resched() is inlined and translates to a single condition.
Yep, that would be fine.
> I don't know why Linux doesn't provide a macro for it, this would be
> useful far beyond dm code.
Agreed, I was very surprised that cond_resched() expands out to a
function call rather than a test + fn call.
Get a patch together and I'll merge.
- Joe
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]