All of lore.kernel.org
 help / color / mirror / Atom feed
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: [PATCH] dm-bufio
Date: Mon, 17 Oct 2011 15:15:22 +0100	[thread overview]
Message-ID: <20111017141521.GB10136@ubuntu> (raw)
In-Reply-To: <Pine.LNX.4.64.1110170958520.14928@hs20-bc2-1.build.redhat.com>

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

  reply	other threads:[~2011-10-17 14:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14 19:14 [PATCH] dm-bufio Mikulas Patocka
2011-10-17 10:08 ` Joe Thornber
2011-10-17 12:41   ` dm-bufio Mike Snitzer
2011-10-17 14:04   ` [PATCH] dm-bufio Mikulas Patocka
2011-10-17 14:15     ` Joe Thornber [this message]
2011-10-17 10:29 ` Joe Thornber
2011-10-17 10:39 ` Joe Thornber
2011-10-17 10:43 ` Joe Thornber
2011-10-17 10:54 ` Joe Thornber
2011-10-17 13:47   ` Mikulas Patocka
2011-10-17 13:57     ` Joe Thornber
2011-10-17 10:57 ` Joe Thornber
2011-10-17 11:11 ` Joe Thornber
2011-10-17 14:05   ` Mikulas Patocka
2011-10-17 14:09     ` Joe Thornber
2011-10-17 16:22       ` Mikulas Patocka
2011-10-17 16:41         ` Joe Thornber
2011-10-17 18:30         ` Joe Thornber
2011-10-17 11:14 ` Joe Thornber
2011-10-17 13:43   ` Mikulas Patocka
2011-10-17 11:29 ` Joe Thornber
2011-10-17 16:24   ` Mikulas Patocka
2011-10-17 16:43     ` Joe Thornber

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=20111017141521.GB10136@ubuntu \
    --to=thornber@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=msnitzer@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.