From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752911AbdARUDq (ORCPT ); Wed, 18 Jan 2017 15:03:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:36215 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751646AbdARUDo (ORCPT ); Wed, 18 Jan 2017 15:03:44 -0500 Date: Wed, 18 Jan 2017 19:15:21 +0100 From: Michal Hocko To: Tim Chen Cc: "Huang, Ying" , Andrew Morton , dave.hansen@intel.com, ak@linux.intel.com, aaron.lu@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins , Shaohua Li , Minchan Kim , Rik van Riel , Andrea Arcangeli , "Kirill A . Shutemov" , Vladimir Davydov , Johannes Weiner , Hillf Danton , Christian Borntraeger , Jonathan Corbet , Tim C Chen Subject: Re: [Update][PATCH v5 7/9] mm/swap: Add cache for swap slots allocation Message-ID: <20170118181520.GB17135@dhcp22.suse.cz> References: <35de301a4eaa8daa2977de6e987f2c154385eb66.1484082593.git.tim.c.chen@linux.intel.com> <87tw8ymm2z.fsf_-_@yhuang-dev.intel.com> <20170117214234.GA14383@linux.intel.com> <20170118124555.GQ7015@dhcp22.suse.cz> <20170118180327.GA24225@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170118180327.GA24225@linux.intel.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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