From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751141AbcAPIIe (ORCPT ); Sat, 16 Jan 2016 03:08:34 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33184 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbcAPIId (ORCPT ); Sat, 16 Jan 2016 03:08:33 -0500 Date: Sat, 16 Jan 2016 17:06:50 +0900 From: Sergey Senozhatsky To: Vlastimil Babka Cc: Sergey Senozhatsky , Minchan Kim , Junil Lee , ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] zsmalloc: fix migrate_zspage-zs_free race condition Message-ID: <20160116080650.GB566@swordfish> References: <1452843551-4464-1-git-send-email-junil0814.lee@lge.com> <20160115143434.GA25332@blaptop.local> <56991514.9000609@suse.cz> <20160116040913.GA566@swordfish> <5699F4C9.1070902@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5699F4C9.1070902@suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (01/16/16 08:44), Vlastimil Babka wrote: > On 16.1.2016 5:09, Sergey Senozhatsky wrote: > > On (01/15/16 16:49), Vlastimil Babka wrote: > > [..] > >> > >> Could you please also help making the changelog more clear? > >> > >>> > >>>> + free_obj |= BIT(HANDLE_PIN_BIT); > >>>> record_obj(handle, free_obj); > >> > >> I think record_obj() should use WRITE_ONCE() or something like that. > >> Otherwise the compiler is IMHO allowed to reorder this, i.e. first to assign > >> free_obj to handle, and then add the PIN bit there. > > > > good note. > > > > ... or do both things in record_obj() (per Minchan) > > > > record_obj(handle, obj) > > { > > *(unsigned long)handle = obj & ~(1< > Hmm but that's an unpin, not a pin? A mistake or I'm missing something? I'm sure it's just a compose-in-mail-app typo. -ss > Anyway the compiler can do the same thing here without a WRITE_ONCE().