lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1425322443.20819.25.camel@picadillo>
Date:	Mon, 02 Mar 2015 12:54:03 -0600
From:	Tom Zanussi <tom.zanussi@...ux.intel.com>
To:	Alexei Starovoitov <ast@...mgrid.com>
Cc:	Steven Rostedt <rostedt@...dmis.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Namhyung Kim <namhyung@...nel.org>,
	Andi Kleen <andi@...stfloor.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 07/15] mm: Add ___GFP_NOTRACE

On Mon, 2015-03-02 at 10:40 -0800, Alexei Starovoitov wrote:
> On Mon, Mar 2, 2015 at 10:25 AM, Tom Zanussi
> <tom.zanussi@...ux.intel.com> wrote:
> > On Mon, 2015-03-02 at 10:12 -0800, Alexei Starovoitov wrote:
> >> On Mon, Mar 2, 2015 at 10:03 AM, Tom Zanussi
> >> <tom.zanussi@...ux.intel.com> wrote:
> >> > On Mon, 2015-03-02 at 09:58 -0800, Alexei Starovoitov wrote:
> >> >> On Mon, Mar 2, 2015 at 8:46 AM, Tom Zanussi <tom.zanussi@...ux.intel.com> wrote:
> >> >> > On Mon, 2015-03-02 at 11:37 -0500, Steven Rostedt wrote:
> >> >> >> On Mon,  2 Mar 2015 10:01:00 -0600
> >> >> >> Tom Zanussi <tom.zanussi@...ux.intel.com> wrote:
> >> >> >>
> >> >> >> > Add a gfp flag that allows kmalloc() et al to be used in tracing
> >> >> >> > functions.
> >> >> >> >
> >> >> >> > The problem with using kmalloc for tracing is that the tracing
> >> >> >> > subsystem should be able to trace kmalloc itself, which it can't do
> >> >> >> > directly because of paths like kmalloc()->trace_kmalloc()->kmalloc()
> >> >> >> > or kmalloc()->trace_mm_page_alloc()->kmalloc().
> >> >> >>
> >> >> >> This part I don't like at all. Why can't the memory be preallocated
> >> >> >> when the hist is created (the echo 'hist:...')?
> >> >> >>
> >> >> >
> >> >> > Yeah, I didn't like it either.  My original version did exactly what you
> >> >> > suggest and preallocated an array of entries to 'allocate' from in order
> >> >> > to avoid the problem.
> >> >> >
> >> >> > But I wanted to attempt to use the bpf_map directly, which already uses
> >> >> > kmalloc internally.  My fallback in case this wouldn't fly, which it
> >> >> > obviously won't, would be to add an option to have the bpf_map code
> >> >> > preallocate a maximum number of entries or pass in a client-owned array
> >> >> > for the purpose.  I'll do that if I don't hear any better ideas..
> >> >>
> >> >> Tom, I'm still reading through the patch set.
> >> >> Quick comment for the above.
> >> >> Currently there are two map types: array and hash.
> >> >> array type is pre-allocating all memory at map creation time.
> >> >> hash is allocating on demand.
> >> >
> >> > OK, so would it make sense to do the same for the hash type, or at least
> >> > add an option that does that?
> >>
> >> I'm not sure what would be the meaning of hash map that has all
> >> elements pre-allocated...
> >
> > The idea would be that instead of getting your individually kmalloc'ed
> > elements on-demand from kmalloc while in the handler, you'd get them
> > from a pool you've pre-allocated when you set up the table.  This could
> > be from a list of individual entries you've already kmalloc'ed ahead of
> > time, or from an array of n * sizeof(entry).
> 
> would work, but kinda ugly, since we will pre-allocate a lot
> and may not be using it at all.
> 

That's true but you have a user-defined map limit anyway, which you can
adjust to minimize wastage.  And allocating ahead of time also means you
perturb the system less while actually tracing.

Tom


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ