All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	lkml <linux-kernel@vger.kernel.org>,
	systemtap <systemtap@sources.redhat.com>,
	DLE <dle-develop@lists.sourceforge.net>,
	Jim Keniston <jkenisto@us.ibm.com>
Subject: Re: [PATCH -tip 3/3] kprobes: cleanup: use list instead of hlist for insn_pages
Date: Wed, 1 Jul 2009 01:18:22 +0200	[thread overview]
Message-ID: <20090630231822.GC17968@elte.hu> (raw)
In-Reply-To: <4A4A9BF1.4090703@redhat.com>


* Masami Hiramatsu <mhiramat@redhat.com> wrote:

> Ingo Molnar wrote:
> > * Masami Hiramatsu <mhiramat@redhat.com> wrote:
> > 
> >> Ingo Molnar wrote:
> >>> * Masami Hiramatsu <mhiramat@redhat.com> wrote:
> >>>
> >>>> Use struct list instead of struct hlist for managing insn_pages, 
> >>>> because insn_pages doesn't use hash table.
> >>>>  struct kprobe_insn_page {
> >>>> -	struct hlist_node hlist;
> >>>> +	struct list_head list;
> >>> Hm, you know that this increases the size of kprobe_insn_page by 4/8 
> >>> bytes, right?
> >> Sure, that will increase size.
> >>
> >>> hlists are not just used for hashes - but also when we want a more 
> >>> compact / smaller list head.
> >> Oh, I thought hlists are used for hash tables...
> > 
> > ... because they are smaller, hence the hash table of list 
> > heads becomes twice as dense as with list_head.
> > 
> > But otherwise it's an (almost) equivalent primitive to list_head, 
> > with a slightly higher runtime cost versus better RAM footprint.
> > 
> >>> How many kprobe_insn_page's can be allocated in the system, 
> >>> maximally?
> >> It's depends on how many probes you will use, but logically, 1 
> >> kprobe_insn_pages is allocated per 4096/16 = 256 probes. So, if 
> >> you use 25,600 probes on your system, memory consumption will 
> >> increase 400/800 bytes.
> > 
> > it's your call really - just wanted to react on the 'because it 
> > should be used for hash tables' comment in the changelog.
> 
> Hi Ingo,
> 
> Would I might be misunderstood?
> 
> struct list_head {
>         struct list_head *next, *prev;
> };
> 
> struct hlist_node {
>         struct hlist_node *next, **pprev;
> };
> 
> Both of list_head and hlist_node are the same size...

ahhh ... a light goes up: i read it as hlist_head, while it's 
hlist_node.

You are right, hlist_node is a needless complication so your cleanup 
is correct.

	Ingo

  reply	other threads:[~2009-06-30 23:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30 21:07 [PATCH -tip 0/3] kprobes: trivial bugfixes and cleanup Masami Hiramatsu
2009-06-30 21:08 ` [PATCH -tip 1/3] kprobes: fix kprobe selftest configuration dependency Masami Hiramatsu
2009-06-30 21:39   ` [tip:tracing/urgent] kprobes: Fix " tip-bot for Masami Hiramatsu
2009-06-30 21:08 ` [PATCH -tip 2/3] kprobes: no need to unlock kprobe_insn_mutex Masami Hiramatsu
2009-06-30 21:40   ` [tip:tracing/urgent] kprobes: No " tip-bot for Masami Hiramatsu
2009-07-01  8:47   ` [tip:tracing/core] " tip-bot for Masami Hiramatsu
2009-06-30 21:08 ` [PATCH -tip 3/3] kprobes: cleanup: use list instead of hlist for insn_pages Masami Hiramatsu
2009-06-30 21:25   ` Ingo Molnar
2009-06-30 21:47     ` Masami Hiramatsu
2009-06-30 21:50       ` Ingo Molnar
2009-06-30 23:12         ` Masami Hiramatsu
2009-06-30 23:18           ` Ingo Molnar [this message]
2009-06-30 23:27   ` [tip:tracing/core] kprobes: Clean up insn_pages by using list instead of hlist tip-bot for Masami Hiramatsu
2009-07-01  8:47   ` tip-bot for Masami Hiramatsu

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=20090630231822.GC17968@elte.hu \
    --to=mingo@elte.hu \
    --cc=ananth@in.ibm.com \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=jkenisto@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=systemtap@sources.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.