From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752903Ab1H2PtP (ORCPT ); Mon, 29 Aug 2011 11:49:15 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]:38842 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751279Ab1H2PtO convert rfc822-to-8bit (ORCPT ); Mon, 29 Aug 2011 11:49:14 -0400 MIME-Version: 1.0 Message-ID: <4be6abb6-7b82-4e64-9e27-cd0fe0c1e1b1@default> Date: Mon, 29 Aug 2011 08:47:59 -0700 (PDT) From: Dan Magenheimer To: KAMEZAWA Hiroyuki Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, jeremy@goop.org, hughd@google.com, ngupta@vflare.org, Konrad Wilk , JBeulich@novell.com, Kurt Hackel , npiggin@kernel.dk, akpm@linux-foundation.org, riel@redhat.com, hannes@cmpxchg.org, matthew@wil.cx, Chris Mason , sjenning@linux.vnet.ibm.com, jackdachef@gmail.com, cyclonusj@gmail.com Subject: RE: Subject: [PATCH V7 2/4] mm: frontswap: core code References: <20110823145815.GA23190@ca-server1.us.oracle.com> <20110825150532.a4d282b1.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.4.1.0 (410211) [OL 12.0.6557.5001] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8BIT X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090204.4E5BB4CA.000A:SCFMA922111,ss=1,re=-4.000,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > My concern was race in counters. Even you allow race in frontswap_succ_puts++, > > > > Don't you need some lock for > > sis->frontswap_pages++ > > sis->frontswap_pages-- > > Hmmm... OK, you've convinced me. If this counter should be one and > a race leaves it as zero, I think data corruption could result on > a swapoff or partial swapoff. And after thinking about it, I > think I also need to check for locking on frontswap_set/clear > as I don't think these bitfield modifiers are atomic. > > Thanks for pointing this out. Good catch! I will need to > play with this and test it so probably will not submit V8 until > next week as today is a vacation day for me. Silly me: Of course set_bit and clear_bit ARE atomic. I will post V8 later today with the only changes being frontswap_pages is now a type atomic_t. Thanks again for catching this, Kame! Thanks, Dan From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail138.messagelabs.com (mail138.messagelabs.com [216.82.249.35]) by kanga.kvack.org (Postfix) with ESMTP id 3E19E900137 for ; Mon, 29 Aug 2011 11:48:37 -0400 (EDT) MIME-Version: 1.0 Message-ID: <4be6abb6-7b82-4e64-9e27-cd0fe0c1e1b1@default> Date: Mon, 29 Aug 2011 08:47:59 -0700 (PDT) From: Dan Magenheimer Subject: RE: Subject: [PATCH V7 2/4] mm: frontswap: core code References: <20110823145815.GA23190@ca-server1.us.oracle.com> <20110825150532.a4d282b1.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Sender: owner-linux-mm@kvack.org List-ID: To: KAMEZAWA Hiroyuki Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, jeremy@goop.org, hughd@google.com, ngupta@vflare.org, Konrad Wilk , JBeulich@novell.com, Kurt Hackel , npiggin@kernel.dk, akpm@linux-foundation.org, riel@redhat.com, hannes@cmpxchg.org, matthew@wil.cx, Chris Mason , sjenning@linux.vnet.ibm.com, jackdachef@gmail.com, cyclonusj@gmail.com > > My concern was race in counters. Even you allow race in frontswap_succ_= puts++, > > > > Don't you need some lock for > > =09sis->frontswap_pages++ > > =09sis->frontswap_pages-- >=20 > Hmmm... OK, you've convinced me. If this counter should be one and > a race leaves it as zero, I think data corruption could result on > a swapoff or partial swapoff. And after thinking about it, I > think I also need to check for locking on frontswap_set/clear > as I don't think these bitfield modifiers are atomic. >=20 > Thanks for pointing this out. Good catch! I will need to > play with this and test it so probably will not submit V8 until > next week as today is a vacation day for me. Silly me: Of course set_bit and clear_bit ARE atomic. I will post V8 later today with the only changes being frontswap_pages is now a type atomic_t. Thanks again for catching this, Kame! Thanks, Dan -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org