From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751409AbdJXB11 (ORCPT ); Mon, 23 Oct 2017 21:27:27 -0400 Received: from mga04.intel.com ([192.55.52.120]:56465 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751327AbdJXB1Y (ORCPT ); Mon, 23 Oct 2017 21:27:24 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,424,1503385200"; d="scan'208";a="1209224220" Subject: Re: [PATCH] buffer: Avoid setting buffer bits that are already set To: Andi Kleen Cc: Jens Axboe , Jan Kara , Darrick J Wong , Eric Biggers , Andreas Gruenbacher , Jeff Layton , Dave , Andi Kleen , Tim Chen , Ying Huang , Aaron Lu , Linux Kernel References: <1508772444-27879-1-git-send-email-kemi.wang@intel.com> <87h8upxrvy.fsf@linux.intel.com> From: kemi Message-ID: <131ef377-7edb-738c-4ed1-debac7857434@intel.com> Date: Tue, 24 Oct 2017 09:25:44 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <87h8upxrvy.fsf@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017年10月24日 09:21, Andi Kleen wrote: > kemi writes: >> >> I'll see if I can find some >>> time to implement the above in a nice way. >> >> Agree. Maybe something like test_and_set_bit() would be more suitable. > > test_and_set_bit is a very different operation for the CPU because > it is atomic for both. But we want the initial read to not > be atomic. > I meant to express the meaning of test before setting bit. Apologize to make you confused. > If you add special functions use a different variant that is only > atomic for the set. > > -Andi >