Re: [PATCH v8] mm: make lru_add_drain_all() selective

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 14 Aug 2013 16:50:29 -0400 Tejun Heo <tj@xxxxxxxxxx> wrote:

> On Wed, Aug 14, 2013 at 01:44:30PM -0700, Andrew Morton wrote:
> > > +static bool need_activate_page_drain(int cpu)
> > > +{
> > > +	return pagevec_count(&per_cpu(activate_page_pvecs, cpu)) != 0;
> > > +}
> > 
> > static int need_activate_page_drain(int cpu)
> > {
> > 	return pagevec_count(&per_cpu(activate_page_pvecs, cpu));
> > }
> > 
> > would be shorter and faster.  bool rather sucks that way.  It's a
> > performance-vs-niceness thing.  I guess one has to look at the call
> > frequency when deciding.
> 
> "!= 0" can be dropped but I'm fairly sure the compiler would be able
> to figure out that the type conversion can be skipped.  It's a trivial
> optimization.

The != 0 can surely be removed and that shouldn't make any difference
to generated code.

The compiler will always need to do the int-to-bool conversion and
that's overhead which is added by using bool.

It's possible that the compiler will optmise away the int-to-bool
conversion when inlining this function into a callsite.  I don't know
whether the compiler _does_ do this and it will be version dependent.


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]