Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2050518imu; Fri, 23 Nov 2018 04:04:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/U9Qq/sQZ2pIWiMQXKkrYKu/42KQzcdPH87SoHRK/TnXUu1eZ1gCDS/hnAHQocW+lU7GGcz X-Received: by 2002:a17:902:42e4:: with SMTP id h91mr15622407pld.18.1542974654554; Fri, 23 Nov 2018 04:04:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542974654; cv=none; d=google.com; s=arc-20160816; b=ZN6P3Zal233saHsgTKHdRpUHAiDAv4aZoIfTM/46OdqjuZruC1LD8Fs+aElajemD1j U5R+gwyXPbaRPogCQPrA1u7M1fpypegGlAR/VTkzpizLSLMK4hwzqKknXsEQez8nSjYh MPJpjx6BIgzflF7YdsvazR2NlBi4okQp2+FudVroZ8XSCDIecJNMnvejZN+8WwS13duE oSjd/HRV/rJ7kd/qRO0o7kLITKTI2I/uy06aA2omkdIE4hvmAd6fNFGaxEhxeb3NbFxH kGm8BVyaunZw1jWCo2G3nWW3g4EwtpnA4jlEh5pnu3p8UBwohXF3JtZRzGA8LdolPSGe 5IJw== 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=8rGhh1J6DeFhkgKAZX2WU2OoJiFc/JRRpogoX8LFcqM=; b=ZsL1k2BAPz3qM4/JiNON/FMZgloAvmm3jrGS+1/eooOVY3SImZR7V8skgws5blgcr/ uPP9d1I4Mmis1sEvPvNBycjtNKGTBR0jhZkI07oiEPfEvInjFPXvVgHP1VOIrQcBnFCd clJfsneCQmbE30fZCHqWnrVGAFwRXRKrQdWXl4O/wmoJIsY0kykBZ+oCZioLQo8+l7AF onERUsCeKBzu5rSs/S4uK+BrBszh9EqYXMFnFkJaSewzuyg2AHQtCoPe/awV9vWOmJe+ HH+F7b8W7aW2vAw3KgW/xEWphI/sIGyowrLUnJJ4EK4xLYT8wCXsyaR+1+JnVyi6PkrT g5/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GNMox95G; 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 c10si5179736pla.173.2018.11.23.04.03.47; Fri, 23 Nov 2018 04:04:14 -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=GNMox95G; 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 S2394484AbeKVVmr (ORCPT + 99 others); Thu, 22 Nov 2018 16:42:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:41520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730534AbeKVVmq (ORCPT ); Thu, 22 Nov 2018 16:42:46 -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 8B25C20820; Thu, 22 Nov 2018 11:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542884633; bh=+gr3xW2xYcoTpvYJRkZ+3FxVvYhT98sZy3/1yf0/G5Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GNMox95GPKObhPHveFqhqLDV4IqKOsp+LeXh8qpsPrWhMY0ySsa3xqmgYxmRmKrii V7slHr6joLtTzVB4oXmT3Lye8Vioqdkja5Lv7qxmv6n4K6URj6taxMAEUhsXOyJ2NL SRsejeOSOd6dcdH0DEOJjuBO2VAoINgYYtbp1ng8= Date: Thu, 22 Nov 2018 12:03:50 +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 04/10] staging: erofs: fix `erofs_workgroup_{try_to_freeze, unfreeze}' Message-ID: <20181122110350.GB5287@kroah.com> References: <20181120143425.43637-1-gaoxiang25@huawei.com> <20181120143425.43637-5-gaoxiang25@huawei.com> <20181122102155.GE3189@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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:29:34PM +0800, Gao Xiang wrote: > Hi Greg, > > On 2018/11/22 18:21, Greg Kroah-Hartman wrote: > > On Tue, Nov 20, 2018 at 10:34:19PM +0800, Gao Xiang wrote: > >> There are two minor issues in the current freeze interface: > >> > >> 1) Freeze interfaces have not related with CONFIG_DEBUG_SPINLOCK, > >> therefore fix the incorrect conditions; > >> > >> 2) For SMP platforms, it should also disable preemption before > >> doing atomic_cmpxchg in case that some high priority tasks > >> preempt between atomic_cmpxchg and disable_preempt, then spin > >> on the locked refcount later. > > > > spinning on a refcount implies that you are trying to do your own type > > of locking. Why not use the in-kernel locking api instead? It will > > always do better than trying to do your own logic as the developers > > there know locking across all types of cpus better than filesystem > > developers :) > > It is because refcount also plays a role as a spinlock on a specific value > (== EROFS_LOCKED_MAGIC), no need to introduce such a value since the spin > window is small. Do not try to overload a reference count as a spinlock, you will run into problems and in the end have to implement everything that the core locking code has done. Your use of this is highly suspect, what happens when you use a "real" spinlock and a "real" reference count instead? Those are two different things from a logical point of view and you are mixing them together which is odd. thanks, greg k-h