All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Dave Jones <davej@redhat.com>
Cc: William Cohen <wcohen@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: Size of 2.6.20 task_struct on x86_64 machines
Date: Sat, 10 Feb 2007 18:55:50 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0702101853140.8424@woody.linux-foundation.org> (raw)
In-Reply-To: <20070211002020.GA6849@redhat.com>



On Sat, 10 Feb 2007, Dave Jones wrote:
> 
> Shrink the held_lock struct by using bitfields.
> This shrinks task_struct on lockdep enabled kernels by 480 bytes.

Are we sure that there are no users that depend on accessing the different 
fields under different locks?

Having them as separate "int" fields means that they don't have any 
interaction, and normal cache coherency will "just work". Once they are 
fields in the same word in memory, updating one field automatically will 
do a read-write cycle on the other fields, and if _they_ are updated by 
interrupts or other CPU's at the same time, a write can get lost..

So I'd like this to be ack'ed by Ingo.

Ingo?

		Linus
---
> Signed-off-by: Dave Jones <davej@redhat.com>
> 
> diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
> index ea097dd..ba81cce 100644
> --- a/include/linux/lockdep.h
> +++ b/include/linux/lockdep.h
> @@ -175,11 +175,11 @@ struct held_lock {
>  	 * The following field is used to detect when we cross into an
>  	 * interrupt context:
>  	 */
> -	int				irq_context;
> -	int				trylock;
> -	int				read;
> -	int				check;
> -	int				hardirqs_off;
> +	unsigned char irq_context:1;
> +	unsigned char trylock:1;
> +	unsigned char read:2;
> +	unsigned char check:1;
> +	unsigned char hardirqs_off:1;
>  };
>  
>  /*
> 
> -- 
> http://www.codemonkey.org.uk
> 

      reply	other threads:[~2007-02-11  2:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-08 16:14 Size of 2.6.20 task_struct on x86_64 machines William Cohen
2007-02-08 20:19 ` David Miller
2007-02-08 21:03   ` Andrew Morton
2007-02-11  0:20 ` Dave Jones
2007-02-11  2:55   ` Linus Torvalds [this message]

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=Pine.LNX.4.64.0702101853140.8424@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=wcohen@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.