Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751952AbdI2ARi (ORCPT ); Thu, 28 Sep 2017 20:17:38 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:50996 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751349AbdI2ARg (ORCPT ); Thu, 28 Sep 2017 20:17:36 -0400 X-Google-Smtp-Source: AOwi7QDBsEnIEBvBz89P2vQ8s9ZR558Hdhn3EB7/5CgRBAQ+4IcpF91FlIhm8ukW64GQ14FJogkBWw== Subject: Re: [PATCH 10/12] writeback: only allow one inflight and pending full flush To: Linus Torvalds , Andrew Morton Cc: Linux Kernel Mailing List , linux-fsdevel , Johannes Weiner , Jan Kara References: <1506543239-31470-1-git-send-email-axboe@kernel.dk> <1506543239-31470-11-git-send-email-axboe@kernel.dk> <20170928144100.e11801ef742521e0e3f4b8df@linux-foundation.org> From: Jens Axboe Message-ID: <552d4502-0b0a-87fc-7b16-6b322c3af3ed@kernel.dk> Date: Fri, 29 Sep 2017 02:17:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 873 Lines: 24 On 09/28/2017 11:44 PM, Linus Torvalds wrote: > On Thu, Sep 28, 2017 at 2:41 PM, Andrew Morton > wrote: >> >> test_and_set_bit()? > > If there aren't any atomicity concerns (either because of higher-level > locking, or because racing and having two people set the bit is fine), > it can be better to do them separately if the test_bit() is the common > case and you can avoid dirtying a cacheline that way. > > But yeah, if that is the case, it might be worth documenting, because > test_and_set_bit() is the more obviously appropriate "there can be > only one" model. It is documented though, but maybe not well enough... I've actually had to document/explain it enough times now, that it might be worth making a general construct. Though it has to be used carefully, so perhaps it's better contained as separate use cases. -- Jens Axboe