public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philipp Reisner <philipp.reisner@linbit.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org, gregkh@suse.de
Subject: Re: [PATCH 02/12] DRBD: activity_log
Date: Wed, 25 Mar 2009 11:57:27 +0100	[thread overview]
Message-ID: <200903251157.27549.philipp.reisner@linbit.com> (raw)
In-Reply-To: <20090325104641.GB11935@one.firstfloor.org>

On Wednesday 25 March 2009 11:46:41 Andi Kleen wrote:
> > > > +	mutex_lock(&mdev->md_io_mutex); /* protects md_io_buffer,
> > > > al_tr_cycle, ... */
> > >
> > > Doing checksumming inside a lock looks nasty.
> >
> > Well, that is a mutex, not a spinlock. We need to hold that lock here,
>
> Yes it's independent. If it takes a lot of CPU time you'll likely have
> a bottle neck. It's normally a bad idea to do anything CPU intensive
> under a lock covering more than your current limited object.
>

We are talking about this checksum and copy to IO page loop:

	for (i = 0; i < mx; i++) {
		extent_nr = lc_entry(mdev->act_log,
				     mdev->al_tr_cycle+i)->lc_number;
		buffer->updates[i+1].pos = cpu_to_be32(mdev->al_tr_cycle+i);
		buffer->updates[i+1].extent = cpu_to_be32(extent_nr);
		xor_sum ^= extent_nr;
	}
	for (; i < AL_EXTENTS_PT; i++) {
		buffer->updates[i+1].pos = __constant_cpu_to_be32(-1);
		buffer->updates[i+1].extent = __constant_cpu_to_be32(LC_FREE);
		xor_sum ^= LC_FREE;
	}

Without being a CPU expert, my guess is that the single XOR instruction
is carried out while the CPU stalls waiting for the next load instruction
to complete.

Sorry, I still do not take the argument that this is "CPU intensive".

-Phil
-- 
: Dipl-Ing Philipp Reisner
: LINBIT | Your Way to High Availability
: Tel: +43-1-8178292-50, Fax: +43-1-8178292-82
: http://www.linbit.com

DRBD(R) and LINBIT(R) are registered trademarks of LINBIT, Austria.


  reply	other threads:[~2009-03-25 11:00 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23 15:47 [PATCH 00/12] DRBD: a block device for HA clusters Philipp Reisner
2009-03-23 15:47 ` [PATCH 01/12] DRBD: lru_cache Philipp Reisner
2009-03-23 15:47   ` [PATCH 02/12] DRBD: activity_log Philipp Reisner
2009-03-23 15:47     ` [PATCH 03/12] DRBD: bitmap Philipp Reisner
2009-03-23 15:47       ` [PATCH 04/12] DRBD: request Philipp Reisner
2009-03-23 15:48         ` [PATCH 05/12] DRBD: userspace_interface Philipp Reisner
2009-03-23 15:48           ` [PATCH 06/12] DRBD: internal_data_structures Philipp Reisner
2009-03-23 15:48             ` [PATCH 07/12] DRBD: main Philipp Reisner
2009-03-23 15:48               ` [PATCH 08/12] DRBD: receiver Philipp Reisner
2009-03-23 15:48                 ` [PATCH 09/12] DRBD: proc Philipp Reisner
2009-03-23 15:48                   ` [PATCH 10/12] DRBD: worker Philipp Reisner
2009-03-23 15:48                     ` [PATCH 11/12] DRBD: misc Philipp Reisner
2009-03-23 15:48                       ` [PATCH 12/12] DRBD: final Philipp Reisner
2009-04-08 10:17                 ` [PATCH 08/12] DRBD: receiver Nikanth K
2009-04-08 15:10                   ` Philipp Reisner
2009-03-23 16:51               ` [PATCH 07/12] DRBD: main Alexey Dobriyan
2009-03-23 22:26                 ` Philipp Reisner
2009-04-08 10:16         ` [PATCH 04/12] DRBD: request Nikanth K
2009-04-08 10:16       ` [PATCH 03/12] DRBD: bitmap Nikanth K
2009-04-08 15:09         ` Philipp Reisner
2009-03-24 12:27     ` [PATCH 02/12] DRBD: activity_log Andi Kleen
2009-03-25 10:27       ` Philipp Reisner
2009-03-25 10:46         ` Andi Kleen
2009-03-25 10:57           ` Philipp Reisner [this message]
2009-03-23 15:58   ` [PATCH 01/12] DRBD: lru_cache Greg KH
2009-04-08 10:15   ` Nikanth K
2009-04-08 15:09     ` Philipp Reisner

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=200903251157.27549.philipp.reisner@linbit.com \
    --to=philipp.reisner@linbit.com \
    --cc=andi@firstfloor.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /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