lkml.org 
[lkml]   [2013]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8] mm: make lru_add_drain_all() selective
Hello,

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.

> > + schedule_work_on(cpu, work);
> > + cpumask_set_cpu(cpu, &has_work);
> > + }
> > + }
> > +
> > + for_each_cpu(cpu, &has_work)
>
> for_each_online_cpu()?

That would lead to flushing work items which aren't used and may not
have been initialized yet, no?

> > + flush_work(&per_cpu(lru_add_drain_work, cpu));
> > +
> > + put_online_cpus();
> > + mutex_unlock(&lock);
> > }
>

Thanks.

--
tejun


\
 
 \ /
  Last update: 2013-08-16 03:21    [W:0.096 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site