Re: [Update][PATCH v5 7/9] mm/swap: Add cache for swap slots allocation

From: Michal Hocko
Date: Wed Jan 18 2017 - 15:03:50 EST


On Wed 18-01-17 10:03:27, Tim Chen wrote:
> On Wed, Jan 18, 2017 at 01:45:55PM +0100, Michal Hocko wrote:
> > On Tue 17-01-17 13:42:35, Tim Chen wrote:
> > [...]
> > > Logic wise, We do allow pre-emption as per cpu ptr cache->slots is
> > > protected by the mutex cache->alloc_lock. We switch the
> > > inappropriately used this_cpu_ptr to raw_cpu_ptr for per cpu ptr
> > > access of cache->slots.
> >
> > OK, that looks better. I would still appreciate something like the
> > following folded in
> > diff --git a/include/linux/swap_slots.h b/include/linux/swap_slots.h
> > index fb907346c5c6..0afe748453a7 100644
> > --- a/include/linux/swap_slots.h
> > +++ b/include/linux/swap_slots.h
> > @@ -11,6 +11,7 @@
> >
> > struct swap_slots_cache {
> > bool lock_initialized;
> > + /* protects slots, nr, cur */
> > struct mutex alloc_lock;
> > swp_entry_t *slots;
> > int nr;
> >
>
> I've included here a patch for the comments.

Thanks!
--
Michal Hocko
SUSE Labs