From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50AC0C43441 for ; Thu, 22 Nov 2018 11:44:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B29B20684 for ; Thu, 22 Nov 2018 11:44:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B29B20684 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391100AbeKVWXC (ORCPT ); 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