Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2203841imu; Fri, 23 Nov 2018 06:04:13 -0800 (PST) X-Google-Smtp-Source: AFSGD/X3hn0BsHb/ha4Q/loBCvupESpHbwMtMsLMB0jTcZ2JwZWsrjF/HHVwt1E506HCmD2A7lUN X-Received: by 2002:a63:1e17:: with SMTP id e23mr14097427pge.130.1542981853716; Fri, 23 Nov 2018 06:04:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542981853; cv=none; d=google.com; s=arc-20160816; b=Tmi0g7d0ReC9IGRz1FUb3ve0hI2HBfkiyXQPyDTb0jdDKay6utn9OKfb98aWKWONzw D6HRLbzhv32t90yG1mArI2NGZl06hPhcrp8uKvycUB2Z3DMCvinl3y7WPCYJEJGodRLO 2qLCJSkRklu1weclX6V08EQ7d9iZ6nNBnPSIRgHCtDQiQHhCWBOUMmMfEXRw1HsozCHP BgliqiV1QSljwW+AfaDsU3uhyhs4usH0n+sSCPf3LJQxKXgWLpjiToW+jq0Lu3cK+5Qd vqSEnB0w4KhZTB/0rEg7R6wF0voWHMx1aeDCjfBskoWoK6p6IThw8A8lNNVMMA1Y+80m DgCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=LeRKpqSMpekpEOc0M1wim7dGlH2uCD2rT+3HsXoi0d0=; b=gPnxdQ2in97FUHyY60zUs50STtYS9l2Frjt3siYdfkrhgCbY/PvmtsNc5op8l2C0s9 Af2YwG9f4CGADsAEVLiIKXUzSGSll/rK82TdLYDY7dxFnC82VDxus+kb9eKR07h00sk1 n8t5u03tFDxl1e8z3Iy55yJBEYSwGUkBzvQV9wFLb9Lk9ClGh7ArfnfLBfXVxbZ9Pjdu HHdwL04F6BsdrOcsQCl5ERDjEVEf5PZLdX2FYC4ChmfxoGPC/AQQx2HzSTxqu2VprKyV Wrtf1DqcxXyxvOZ0uY4NjoR5Q6Na5K+BF153nhy+6GLBDAfqsQ0itYHBktUaBNqoIPhH wANA== ARC-Authentication-Results: i=1; mx.google.com; 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 g33si33539659pgm.426.2018.11.23.06.03.47; Fri, 23 Nov 2018 06:04:13 -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; 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 S2388777AbeKVWXC (ORCPT + 99 others); Thu, 22 Nov 2018 17:23:02 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:15576 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726671AbeKVWXB (ORCPT ); Thu, 22 Nov 2018 17:23:01 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 7FE22E6A987E9; Thu, 22 Nov 2018 19:43:56 +0800 (CST) Received: from [10.151.23.176] (10.151.23.176) by smtp.huawei.com (10.3.19.207) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 22 Nov 2018 19:43:48 +0800 Subject: Re: [PATCH 02/10] staging: erofs: fix race when the managed cache is enabled To: Greg Kroah-Hartman CC: , , Chao Yu , LKML , , Miao Xie References: <20181120143425.43637-1-gaoxiang25@huawei.com> <20181120143425.43637-3-gaoxiang25@huawei.com> <20181122101711.GA3189@kroah.com> <55aed87f-196e-9048-6aae-db09bc497664@huawei.com> <20181122110642.GE5287@kroah.com> From: Gao Xiang Message-ID: <78f8bed5-5f7f-8ca6-5d7a-3a94a2062425@huawei.com> Date: Thu, 22 Nov 2018 19:43:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20181122110642.GE5287@kroah.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.151.23.176] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On 2018/11/22 19:06, Greg Kroah-Hartman wrote: > 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? As I said in the previous email, every compressed page will have a managed structure called erofs_workgroup, and it is heavily allocated like page/inode/dentry in the erofs. > > 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". The function is much like lockref (aligned_u64 lock_count;) with the exception as my previous email explained. Thanks, Gao Xiang > > thanks, > > greg k-h