From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750877AbcAPEK6 (ORCPT ); Fri, 15 Jan 2016 23:10:58 -0500 Received: from mail-pa0-f68.google.com ([209.85.220.68]:33508 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750802AbcAPEK4 (ORCPT ); Fri, 15 Jan 2016 23:10:56 -0500 Date: Sat, 16 Jan 2016 13:09:13 +0900 From: Sergey Senozhatsky To: Vlastimil Babka Cc: 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, sergey.senozhatsky@gmail.com Subject: Re: [PATCH v2] zsmalloc: fix migrate_zspage-zs_free race condition Message-ID: <20160116040913.GA566@swordfish> References: <1452843551-4464-1-git-send-email-junil0814.lee@lge.com> <20160115143434.GA25332@blaptop.local> <56991514.9000609@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56991514.9000609@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/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<