All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Jennifer Herbert <Jennifer.Herbert@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	David Vrabel <david.vrabel@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [PATCHv1 3/4] spinlock: shrink struct lock_debug
Date: Tue, 19 Jan 2016 06:04:23 -0700	[thread overview]
Message-ID: <569E426702000078000C882F@prv-mh.provo.novell.com> (raw)
In-Reply-To: <569E2C9D.2040901@citrix.com>

>>> On 19.01.16 at 13:31, <Jennifer.Herbert@citrix.com> wrote:
> On 18/12/15 16:58, Jan Beulich wrote:
>>>>> On 18.12.15 at 15:09, <david.vrabel@citrix.com> wrote:
>>> --- a/xen/common/spinlock.c
>>> +++ b/xen/common/spinlock.c
>>> @@ -16,7 +16,7 @@ static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0);
>>>   
>>>   static void check_lock(struct lock_debug *debug)
>>>   {
>>> -    int irq_safe = !local_irq_is_enabled();
>>> +    s16 irq_safe = !local_irq_is_enabled();
>>>   
>>>       if ( unlikely(atomic_read(&spin_debug) <= 0) )
>>>           return;
>> I can't figure out why this odd looking change is needed.
> 
> This patch shrinks struct lock_debug's irq_safe member.  Since you end 
> up with many instances of this embedded in other structures such as 
> struct domain, this become a useful saving in memory.  At one point, I 
> had an issue with struct domain exceeding 4k, which caused trouble.
> Given the change to struct_lock debug,  this local variable irq_safe, is 
> compared with it, and used in cmpxchg with it it, and therefore should 
> match type.

I don't think the type of the local variable matters for the cmpxchg();
note how the literal -1 is also not of type s16. Also if what you say
was to be consistent, the type of "seen" would need to be changed
too. Afaict all that can happen from the proposed type change is
worse generated code (which doesn't matter much as it's debug-only
code, but anyway).

Jan

  reply	other threads:[~2016-01-19 13:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 14:09 [PATCHv1 0/4] spinlock: add qrwlocks David Vrabel
2015-12-18 14:09 ` [PATCHv1 1/4] atomic: replace atomic_compareandswap() with atomic_cmpxchg() David Vrabel
2015-12-18 17:01   ` Jan Beulich
2016-01-21 15:19   ` Ian Campbell
2015-12-18 14:09 ` [PATCHv1 2/4] x86/domain: Compile with lock_profile=y enabled David Vrabel
2015-12-18 14:09 ` [PATCHv1 3/4] spinlock: shrink struct lock_debug David Vrabel
2015-12-18 16:58   ` Jan Beulich
2016-01-19 12:31     ` Jennifer Herbert
2016-01-19 13:04       ` Jan Beulich [this message]
2015-12-18 14:09 ` [PATCHv1 4/4] spinlock: add fair read-write locks David Vrabel
2015-12-22 13:54   ` Jan Beulich
2016-01-18 16:44     ` Jennifer Herbert
2015-12-18 15:47 ` [PATCHv1 0/4] spinlock: add qrwlocks Ian Campbell
2015-12-18 15:49   ` David Vrabel

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=569E426702000078000C882F@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=Jennifer.Herbert@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xenproject.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 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.