public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Peschke <mp3@de.ibm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel@vger.kernel.org, jbaron@redhat.com,
	rostedt@goodmis.org, billh@gnuppy.monkey.org, mingo@elte.hu,
	linux-s390@vger.kernel.org
Subject: Re: [RFC] [Patch 4/4] lock contention tracking slimmed down
Date: Mon, 11 Jun 2007 14:20:51 +0200	[thread overview]
Message-ID: <466D3E23.3020009@de.ibm.com> (raw)
In-Reply-To: <1181204221.7348.238.camel@twins>

Peter Zijlstra wrote:
> On Wed, 2007-06-06 at 23:34 +0200, Martin Peschke wrote:
> 
>> +#ifdef CONFIG_LOCK_STAT
>> +enum lock_stat_enum {
>> +	LOCK_STAT_CONT,
>> +	LOCK_STAT_WAIT_READ,
>> +	LOCK_STAT_WAIT_WRITE,
>> +	LOCK_STAT_HOLD_READ,
>> +	LOCK_STAT_HOLD_WRITE,
>> +	_LOCK_STAT_NUMBER
>> +};
>> +#endif
>> +
>>  /*
>>   * The lock-class itself:
>>   */
>> @@ -117,30 +129,11 @@ struct lock_class {
>>  	int				name_version;
>>  
>>  #ifdef CONFIG_LOCK_STAT
>> -	unsigned long			contention_point[4];
>> +	struct statistic		stat[_LOCK_STAT_NUMBER];
>> +	struct statistic_coll		stat_coll;
>>  #endif
>>  };
> 
> 
> sizeof(struct statistic_coll) = 16+64+8+8+4+8+8 = 116
> sizeof(struct statistic) = 4+4+8+8+8+8+8+4+8+4+4 = 68
>                          + 8*NR_CPUS
> 			 + kmalloc_size(obj)*nr_cpu_ids
> 
> 
> 4 objs with size 40, gives 4*64 = 256 * nr_cpu_ids

This looks like 4 * struct statistic_entry_util with members
for min, max etc. Used for contention point tracking.

I have noticed that many lock classes show less than 4, or even no
contention points. Unlike the original code, my code doesn't eat
up memory for contentions that don't show.

I doubt that my patch scores 414400 bytes per cpu then.

> 1 obj with size 32 + more
> 
> 
> for 2048 total classes this gives:
> 
> 2048 * (116+68) = 376832
> 
> for each active class this adds per cpu:
> 
>   8+256+32+some = 296+
> 
> we have around 1400 locks in the kernel, this would give 414400 per cpu.
> 
> vs the old code:
> 
> 2048*(4*8) = 65536
> +
> 2048*(4*4*8 + 4*8) = 327680 per cpu
> 
> worst case
> 
> I'm not convinced 300 lines less code is worth that extra bloat.

In general, you are right.

First, struct statistic is too expensive. Allowing sets of statistics
instead of individual statistics to be switched on and off would suffice
surely. This alone would allow to move several members from struct
statistic to struct statistic_coll (one per lock class) or struct
statistic_ui (for all lock contention statistics). In the end it might
be feasible to reduce struct statistic to a per-cpu data pointer.

Second, my code should not depend on struct statistic and percpu_alloc,
allowing users to bring their own static data areas, at least for simple
things like counters, min, max etc.

Martin


      parent reply	other threads:[~2007-06-11 12:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06 21:34 [RFC] [Patch 4/4] lock contention tracking slimmed down Martin Peschke
2007-06-06 23:06 ` Ingo Molnar
2007-06-07  0:17   ` Martin Peschke
2007-06-07  4:40     ` Bill Huey
2007-06-07  7:03       ` Martin Peschke
2007-06-07  7:30         ` Ingo Molnar
2007-06-07  8:56           ` Bill Huey
2007-06-11 11:26             ` Martin Peschke
2007-06-08 16:27           ` Martin Peschke
2007-06-07  6:39     ` Peter Zijlstra
2007-06-07  6:59       ` Martin Peschke
2007-06-07  7:27         ` Ingo Molnar
2007-06-08 16:07           ` Martin Peschke
2007-06-06 23:10 ` Ingo Molnar
2007-06-07  0:21   ` Martin Peschke
2007-06-07  7:44 ` Peter Zijlstra
2007-06-08 17:00   ` Martin Peschke
     [not found]     ` <1181322460.5728.2.camel@lappy>
     [not found]       ` <46698F7F.4090407@de.ibm.com>
2007-06-08 17:27         ` Peter Zijlstra
2007-06-08 17:37           ` Martin Peschke
2007-06-08 17:50             ` Peter Zijlstra
2007-06-11 10:31               ` Martin Peschke
2007-06-07  7:51 ` Peter Zijlstra
2007-06-08 17:13   ` Martin Peschke
2007-06-07  8:17 ` Peter Zijlstra
2007-06-07 10:21   ` Ingo Molnar
2007-06-11 12:20   ` Martin Peschke [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=466D3E23.3020009@de.ibm.com \
    --to=mp3@de.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=billh@gnuppy.monkey.org \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.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