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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150521083612.GH11112@norris-Latitude-E6410>
Date:	Thu, 21 May 2015 01:36:12 -0700
From:	Brian Norris <computersforpeace@...il.com>
To:	Denys Vlasenko <dvlasenk@...hat.com>
Cc:	David Woodhouse <David.Woodhouse@...el.com>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Jingoo Han <jg1.han@...sung.com>,
	Aaron Sierra <asierra@...-inc.com>,
	Artem Bityutskiy <Artem.Bityutskiy@...ux.intel.com>,
	linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtd: cfi: Deiline large functions

On Thu, May 21, 2015 at 09:50:38AM +0200, Denys Vlasenko wrote:
> On 05/20/2015 08:56 PM, Brian Norris wrote:
> > On Mon, May 18, 2015 at 12:58:40PM +0200, Denys Vlasenko wrote:
> >> With this .config: http://busybox.net/~vda/kernel_config,
> >> after uninlining these functions have sizes and callsite counts
> >> as follows:
> > 
> > Most of this is probably good, thanks. But I'm curious about one:
> > 
> >> cfi_udelay(): 74 bytes, 26 callsites
> > 
> > ^^ This is pretty dead-simple. If it's generating bad code, we might
> > look at fixing it up instead. Almost all of its call sites are with
> > constant input, so it *should* just become:
> > 
> > 	udelay(1);
> > 	cond_resched();
> > 
> > in most cases. For the non-constant cases, we might still do an
> > out-of-line implementation. Or maybe we just say it's all not worth it,
> > and we just stick with what you have. But I'd like to consider
> > alternatives to out-lining this one.
> 
> You want to consider not-deinlining (IOW: speed-optimizing)

Inlining isn't always about speed.

> a *fixed time delay function*?
> 
> Think about what delay functions do...

I wasn't really looking at speed. Just memory usage.

And I was only pointing this out because udelay() has a different
implementation for the __builtin_constant_p() case. You can't take
advantage of that for non-inlined versions of cfi_udelay().

But that may be irrelevant anyway, now that I think again. At best,
you're trading one function call (arm_delay_ops.const_udelay() on ARM)
for another (cfi_udelay()), since you can never completely optimize out
the latter. And in fact, my suggestion yields extra inlined calls, due
to the cond_resched().

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