lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 18 Jan 2017 10:03:27 -0800
From:   Tim Chen <tim.c.chen@...ux.intel.com>
To:     Michal Hocko <mhocko@...nel.org>
Cc:     "Huang, Ying" <ying.huang@...el.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        dave.hansen@...el.com, ak@...ux.intel.com, aaron.lu@...el.com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Hugh Dickins <hughd@...gle.com>, Shaohua Li <shli@...nel.org>,
        Minchan Kim <minchan@...nel.org>,
        Rik van Riel <riel@...hat.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
        Vladimir Davydov <vdavydov.dev@...il.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Hillf Danton <hillf.zj@...baba-inc.com>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        Jonathan Corbet <corbet@....net>,
        Tim C Chen <tim.c.chen@...el.com>
Subject: Re: [Update][PATCH v5 7/9] mm/swap: Add cache for swap slots
 allocation

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.

Tim

--->8---
From: Tim Chen <tim.c.chen@...ux.intel.com>
Date: Wed, 18 Jan 2017 09:52:28 -0800
Subject: [PATCH] mm/swap: Add comments on locks in swap_slots.h
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Ying Huang <ying.huang@...el.com>, dave.hansen@...el.com, ak@...ux.intel.com, aaron.lu@...el.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org, Hugh Dickins <hughd@...gle.com>, Shaohua Li <shli@...nel.org>, Minchan Kim <minchan@...nel.org>, Rik van Riel <riel@...hat.com>, Andrea Arcangeli <aarcange@...hat.com>, Kirill A . Shutemov <kirill.shutemov@...ux.intel.com>, Vladimir Davydov <vdavydov.dev@...il.com>, Johannes Weiner <hannes@...xchg.org>, Michal Hocko <mhocko@...nel.org>, Hillf Danton <hillf.zj@...baba-inc.com>, Christian Borntraeger <borntraeger@...ibm.com>, Jonathan Corbet <corbet@....net>

Explains what each lock protects in swap_slots_cache structure.

Signed-off-by: Tim Chen <tim.c.chen@...ux.intel.com>
---
 include/linux/swap_slots.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/swap_slots.h b/include/linux/swap_slots.h
index fb90734..6ef92d1 100644
--- a/include/linux/swap_slots.h
+++ b/include/linux/swap_slots.h
@@ -11,11 +11,11 @@
 
 struct swap_slots_cache {
 	bool		lock_initialized;
-	struct mutex	alloc_lock;
+	struct mutex	alloc_lock; /* protects slots, nr, cur */
 	swp_entry_t	*slots;
 	int		nr;
 	int		cur;
-	spinlock_t	free_lock;
+	spinlock_t	free_lock;  /* protects slots_ret, n_ret */
 	swp_entry_t	*slots_ret;
 	int		n_ret;
 };
-- 
2.5.5


Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ