All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Miao Xie <miaox@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 5/6] Btrfs: use flags instead of the bool variants in delayed node
Date: Tue, 7 Jan 2014 22:11:32 +0100	[thread overview]
Message-ID: <20140107211132.GD6498@suse.cz> (raw)
In-Reply-To: <52CB7B96.2020701@cn.fujitsu.com>

On Tue, Jan 07, 2014 at 11:59:18AM +0800, Miao Xie wrote:
> But I read a discuss about the use of boolean type, some developers suggested
> us to use bitfields instead of bool, because the bitfields can work better,
> and they are more flexible, less misuse than bool.
>   https://lkml.org/lkml/2013/9/1/154

I was searching for pros/cons of the bools but haven't found this one
nor anything useful, though not all of the advantages of bitfields apply
in our case.

I've compared the generated assembly with just this patch, and the
difference is effectively only the lock prefix for set/clear, the read
side has no significant penalty:

old:
  mov    0x128(%rbx),%esi

new:
  mov    0x120(%rbx),%rax
  test   $0x1,%al


old set:
  movb   $0x1,0x120(%rbx)

new:
  lock orb $0x1,0x120(%rbx)

The delayed_node structure is relatively short lived, is reused
frequently and I haven't seen any contention points where the lock
prefix would hurt.

So, ok to merge it.

  reply	other threads:[~2014-01-07 21:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-26  5:07 [PATCH v2 1/6] Btrfs: remove residual code in delayed inode async helper Miao Xie
2013-12-26  5:07 ` [PATCH v2 2/6] Btrfs: don't run delayed nodes again after all nodes flush Miao Xie
2013-12-26  5:07 ` [PATCH v2 3/6] Btrfs: cleanup code of btrfs_balance_delayed_items() Miao Xie
2013-12-26  5:07 ` [PATCH v2 4/6] Btrfs: remove btrfs_end_transaction_dmeta() Miao Xie
2013-12-26  5:07 ` [PATCH v2 5/6] Btrfs: use flags instead of the bool variants in delayed node Miao Xie
2014-01-02 17:49   ` David Sterba
2014-01-03  9:27     ` Miao Xie
2014-01-03 18:36       ` David Sterba
2014-01-07  3:59         ` Miao Xie
2014-01-07 21:11           ` David Sterba [this message]
2013-12-26  5:07 ` [PATCH v2 6/6] Btrfs: introduce the delayed inode ref deletion for the single link inode Miao Xie

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=20140107211132.GD6498@suse.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=miaox@cn.fujitsu.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.