lkml.org 
[lkml]   [2011]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5]: Improve performance of LZO hibernation
From
Date
On Wed, 2011-09-28 at 10:22 +0300, Pekka Enberg wrote:

> > + while(1) {
> > + wait_event(d->go, atomic_read(&d->ready) ||
> > + kthread_should_stop());
> > + if (kthread_should_stop())
> > + break;
>
> So... what happens to the hibernation process when 'kthread_should_stop()'
> returns true?

The compression/decompression threads stop by breaking out of the loop.
At least they should, right? Did I misread some docs here?

PS. I'm not really a kernel programmer, so I'm kinda stumbling my way
through all this.

> > + nthr = num_online_cpus() - 1;
> > + nthr = nthr > LZO_THREADS ? LZO_THREADS : (nthr < 1 ? 1 : nthr);
>
> That's probably one of the most unreadable uses of the ternary
> operator I've ever seen!

Sorry about that. I can simplify.

> What's going on here anyway? Why "num_online_cpus() - 1"? What's wrong with
>
> nr_threads = num_online_cpus();
> if (nr_threads > LZO_THREADS)
> nr_threads = LZO_THREADS;

We want to keep at least one CPU free for that I/O and for pulling the
other threads into sync when they are done (that is if we have more than
one), right?

> [ And yes, please use less cryptic variable names. ]

OK, been pulled over for that before. Will fix.

> Overall, I really like your patch!

Thanks, hopefully it doesn't blow up too many file systems :-)

--
Bojan



\
 
 \ /
  Last update: 2011-09-28 09:31    [W:0.081 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site