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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1294062351.3948.7.camel@gandalf.stny.rr.com>
Date:	Mon, 03 Jan 2011 08:45:51 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Pekka Enberg <penberg@...nel.org>
Cc:	Minchan Kim <minchan.kim@...il.com>, Theodore Ts'o <tytso@....edu>,
	Christoph Lameter <cl@...ux-foundation.org>,
	Pekka Enberg <penberg@...helsinki.fi>,
	Matt Mackall <mpm@...enic.com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, David Rientjes <rientjes@...gle.com>,
	npiggin@...nel.dk
Subject: Re: Should we be using unlikely() around tests of GFP_ZERO?

On Mon, 2011-01-03 at 09:40 +0200, Pekka Enberg wrote:
> Hi,
> 
> On Mon, Jan 3, 2011 at 8:48 AM, Theodore Ts'o <tytso@....edu> wrote:
> >> Given the patches being busily submitted by trivial patch submitters to
> >> make use kmem_cache_zalloc(), et. al, I believe we should remove the
> >> unlikely() tests around the (gfp_flags & __GFP_ZERO) tests, such as:
> >>
> >> -       if (unlikely((flags & __GFP_ZERO) && objp))
> >> +       if ((flags & __GFP_ZERO) && objp)
> >>                memset(objp, 0, obj_size(cachep));
> >>
> >> Agreed?  If so, I'll send a patch...
> 
> On Mon, Jan 3, 2011 at 5:46 AM, Minchan Kim <minchan.kim@...il.com> wrote:
> > I support it.
> 
> I guess the rationale here is that if you're going to take the hit of
> memset() you can take the hit of unlikely() as well. We're optimizing
> for hot call-sites that allocate a small amount of memory and
> initialize everything themselves. That said, I don't think the
> unlikely() annotation matters much either way and am for removing it
> unless people object to that.
> 
> On Mon, Jan 3, 2011 at 5:46 AM, Minchan Kim <minchan.kim@...il.com> wrote:
> > Recently Steven tried to gather the information.
> > http://thread.gmane.org/gmane.linux.kernel/1072767
> > Maybe he might have a number for that.
> 
> That would be interesting, sure.

Note, you could do it yourself too. Just enable:

  Kernel Hacking -> Tracers -> Branch Profiling
    (Trace likely/unlikely profiler)

   CONFIG_PROFILE_ANNOTATED_BRANCHES

Then search /debug/tracing/trace_stats/branch_annotated.

(hmm, the help in Kconfig is wrong, I need to fix that)


Anyway, here's my box. I just started it an hour ago, and have not been
doing too much on it yet. But here's what I got (using SLUB)


 correct incorrect  %        Function                  File              Line
 ------- ---------  -        --------                  ----              ----
 6890998  2784830  28        slab_alloc                slub.c            1719

That's incorrect 28% of the time.

-- Steve


--
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