From: Alexey Dobriyan <adobriyan@gmail.com>
To: Roland McGrath <roland@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] utrace core
Date: Wed, 3 Sep 2008 21:01:02 +0400 [thread overview]
Message-ID: <20080903170102.GC5604@x200.localdomain> (raw)
In-Reply-To: <20080903121127.2B368154228@magilla.localdomain>
On Wed, Sep 03, 2008 at 05:11:27AM -0700, Roland McGrath wrote:
> > Again, embed struct utrace directly into task_struct. task_struct
> > lifetime rules are way more tested than struct utrace ones.
>
> The most consistent feedback I've seen to all new features is that they
> mustn't add overhead when they're not being used.
That's correct but shouldn't be taken to extreme as usual.
> So I never considered it an option to bloat task_struct by ~120 bytes.
By how many?
> Of course much more than that is entailed when a task is actually being
> traced somehow.
Engine part is irrelevant for deciding "struct utrace utrace;" vs
"struct utrace *utrace;"
> But the presumption is that most tasks most of the time aren't, and that's
> what not to bloat.
Let's actually measure something.
1) clean kernel (my usual config, x86_64, NR_CPUS=2, PREEMPT=y, SLUB_DEBUG=y)
2) struct utrace *utrace;
3) struct utrace utrace; (without rcu_head, without check_dead)
taken from symlink
cache /object_size, bytes
----------------------------------------
1) task_struct 1392/1384
2) task_struct 1408/1400
utrace 72/72
3) task_struct 1456/1456
I don't know why "object_size" differs from to where symlink points to
but it's irrelevant.
So, your approach gives +16(+72) bytes, mine gives +72 bytes.
So all this complexity is for ~56 bytes in untraced case. In traced
case, more memory will be used.
For 32-bit difference should be smaller because pointers are smaller.
> The revamp of the API after the first prototype made some of the internals
> much simpler to implement, that had been very sticky in the old prototype
> code. But the allocation and freeing of struct utrace is an area I did not
> fully revisit. Buggy is buggy, and sure it needs to be tested and fixed.
> I'm still inclined to look into making it right rather than punting.
>
> > Add simple spinlock guarding all accesses (OK, I haven't looked very
> > closely if it's possible)
>
> I can't tell what you mean here. Do you mean something different
> from struct utrace.lock? If there were no pointer and its allocation
> to synchronize, then what other lock would you be adding?
I mean sticking to simple locking rules if you agree to "struct utrace utrace;":
1) utrace_flags go into struct utrace
2) utrace.lock guards _everything_ under it, no exceptions.
If I understand correctly ->utrace_flags are under utrace->lock, BUT
struct utrace is reattachable itself. Of course you protect against it,
but this doesn't help in convincing someone that there are no problems.
Again, this is just general observation and an example. Checking for
bugs will be much, much simpler.
next prev parent reply other threads:[~2008-09-03 16:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-26 22:01 [PATCH 0/2] utrace Roland McGrath
2008-08-26 22:01 ` [PATCH 1/2] utrace core Roland McGrath
2008-08-26 22:55 ` Alexey Dobriyan
2008-08-27 21:32 ` Alexey Dobriyan
2008-08-27 21:46 ` Alexey Dobriyan
2008-08-27 22:00 ` Alexey Dobriyan
2008-08-30 13:45 ` Christoph Hellwig
2008-09-03 12:11 ` Roland McGrath
2008-09-03 17:01 ` Alexey Dobriyan [this message]
2008-08-27 20:04 ` Alexey Dobriyan
2008-09-03 12:11 ` Roland McGrath
2008-09-03 18:44 ` Christoph Hellwig
2008-08-30 15:05 ` Alexey Dobriyan
2008-09-03 12:58 ` Petr Tesarik
2008-09-03 18:08 ` Roland McGrath
2008-09-03 18:46 ` Christoph Hellwig
2008-09-04 9:03 ` Petr Tesarik
2008-08-26 22:02 ` [PATCH 2/2] utrace: ptrace cooperation Roland McGrath
2008-08-30 13:38 ` Christoph Hellwig
2008-09-03 12:10 ` Roland McGrath
2008-09-03 18:41 ` Christoph Hellwig
2008-08-26 22:34 ` [PATCH 0/2] utrace Alexey Dobriyan
2008-08-26 22:39 ` Christoph Hellwig
2008-08-27 0:17 ` Frank Ch. Eigler
2008-08-27 13:54 ` Christoph Hellwig
2008-08-27 16:40 ` Ananth N Mavinakayanahalli
2008-08-30 13:40 ` Christoph Hellwig
2008-09-03 12:09 ` Roland McGrath
2008-09-03 18:37 ` Christoph Hellwig
2008-08-27 15:34 ` Alexey Dobriyan
2008-08-29 19:04 ` Frank Ch. Eigler
2008-08-30 13:43 ` Christoph Hellwig
2008-08-27 18:50 ` Alexey Dobriyan
2008-08-27 2:03 ` Peter Zijlstra
2008-10-06 20:47 ` Peter Zijlstra
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=20080903170102.GC5604@x200.localdomain \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=torvalds@linux-foundation.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
Powered by JetHome