Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1901369imu; Fri, 23 Nov 2018 01:45:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/XRWlYiU94qP63JPazbnYEhj05xysHcE3s2C4JzVjxP1g4ZFwRhFLE6x4B/iIXqzw7YD9md X-Received: by 2002:a17:902:e01:: with SMTP id 1-v6mr14416774plw.251.1542966340088; Fri, 23 Nov 2018 01:45:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542966340; cv=none; d=google.com; s=arc-20160816; b=M8Y9YCfKnqbkJSauLQwJusvVC0K4jMTC96QDPDcK+xkqMShruuOsSQJgJQayno/pat vH1g+hDUOUk2g6Il4bjWbFg3s2UH2cDjec25cw4jVIn/e0A1u+g3IioC5NpXHSi9OCPL VbKa77y1F/fPHoknud6Hd8kkRxfIWJwhg1N1UGG7ioQlraAWhUvqh7epz35N6t9Cu89z 5HfdxqEdsZUMnBJ3l16Yd0IAThV3TtKOmqj/c4OCaHayG6yllZPaelhM3beTJdqoIsVh YWBBLaVS4mvHdswlUkQcV8t7ZRN5glBM1HZr9Y7kIMNfUMNG7uRiwAu3SYcd8Z/bdIPJ DPGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wZG1U39TDVUjmcu9iIwbpeTRvpz2aFJsThUUdXC8rsQ=; b=yqJkVmv5fttuu1AJOmJVa5Njsw8Q6isq/JthVGlZuoJuSiiaNe8wViumFt3iTR97/L +4xB2Z9I89qL3b3LgVFoZqzGrge4JdobErdKiRss0RGpWyORB7pKgkoL8FH5A9uzVOqJ 9DcJFyN7KcpRQEoM14URIKXD+3HK5eK+IFnHdbHYqCNMi6XFCxXhkivj2hoIy7LrJ97n c9hJ+g+/MaCeI3IPwDr0q8Jo6oGoKUsvWM/FDritLykKfE326/ve4IOetReCpjLn2eaB 4zjCr8q2uOTjHESq4m54wBTcA+v9QTNL8YZlgTH2PHIi0IsVXqWX1eJojhRvmJkOysRB TRLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wc7zpghU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj7-v6si53186386plb.193.2018.11.23.01.45.25; Fri, 23 Nov 2018 01:45:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wc7zpghU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405473AbeKVVpl (ORCPT + 99 others); Thu, 22 Nov 2018 16:45:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:42268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388478AbeKVVpl (ORCPT ); Thu, 22 Nov 2018 16:45:41 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3DC3620820; Thu, 22 Nov 2018 11:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542884806; bh=SMIg++zaY+IyXYtdl6FokJtICJoz0vXF9/f3pAGgnJE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wc7zpghU0yLT+PrLvaxlNHLXOvBQ/cI2wSIrZNnAt3pMoexypCdkyS4CXp1uzhB4d 5Rz7bxWg16b9tJws9jESTsCDHBbe7169ejE6OZVFd9gb2acb7KPRxx8ZaMxo2LtRPI 6xW2AX5/+R5zFZbKp2H22T9AWBJIuB9HBs2EB6Ek= Date: Thu, 22 Nov 2018 12:06:42 +0100 From: Greg Kroah-Hartman To: Gao Xiang Cc: devel@driverdev.osuosl.org, linux-erofs@lists.ozlabs.org, Chao Yu , LKML , weidu.du@huawei.com, Miao Xie Subject: Re: [PATCH 02/10] staging: erofs: fix race when the managed cache is enabled Message-ID: <20181122110642.GE5287@kroah.com> References: <20181120143425.43637-1-gaoxiang25@huawei.com> <20181120143425.43637-3-gaoxiang25@huawei.com> <20181122101711.GA3189@kroah.com> <55aed87f-196e-9048-6aae-db09bc497664@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55aed87f-196e-9048-6aae-db09bc497664@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 22, 2018 at 06:42:52PM +0800, Gao Xiang wrote: > Hi Greg, > > On 2018/11/22 18:17, Greg Kroah-Hartman wrote: > > Any specific reason why you are not using the refcount.h api instead of > > "doing it yourself" with atomic_inc/dec()? > > > > I'm not rejecting this, just curious. > > As I explained in the previous email, > Re: [PATCH 04/10] staging: erofs: fix `erofs_workgroup_{try_to_freeze, unfreeze}' > > we need such a function when the value is >= 0, it plays as a refcount, > but when the refcount == EROFS_LOCKED_MAGIC (<0, but not 0 as refcount.h), > and actually there is no need to introduce a seperate spinlock_t because > we don't actually care about its performance (rarely locked). and > the corresponding struct is too large for now, we need to decrease its size. Why do you need to decrease the size? How many of these structures are created? And you will care about the performance when a lock is being held, as is evident by your logic to try to fix those issues in this patch series. Using a "real" lock will solve all of that and keep you from having to implement it all "by hand". thanks, greg k-h