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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66551C433F5 for ; Thu, 3 Mar 2022 02:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231759AbiCCC2D (ORCPT ); Wed, 2 Mar 2022 21:28:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231747AbiCCC2B (ORCPT ); Wed, 2 Mar 2022 21:28:01 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10A79C0D for ; Wed, 2 Mar 2022 18:27:17 -0800 (PST) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4K8FGF4CJxzdZRs; Thu, 3 Mar 2022 10:25:57 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 3 Mar 2022 10:27:14 +0800 Subject: Re: [PATCH 6/9] mm/z3fold: move decrement of pool->pages_nr into __release_z3fold_page() To: Vitaly Wool CC: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "akpm@linux-foundation.org" , David Laight References: <20220219092533.12596-1-linmiaohe@huawei.com> <20220219092533.12596-7-linmiaohe@huawei.com> <03647389a32045f38ec18b090548a26d@AcuMS.aculab.com> From: Miaohe Lin Message-ID: <7fab39f6-1a65-9577-4ddf-f3e984474844@huawei.com> Date: Thu, 3 Mar 2022 10:27:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/3/2 18:19, Vitaly Wool wrote: > On Wed, Mar 2, 2022 at 10:12 AM David Laight wrote: >> >>>> Atomic operations aren't magic. >>>> Atomic operations are (at best) one slow locked bus cycle. >>>> Acquiring a lock is the same. >>>> Releasing a lock might be cheaper, but is probably a locked bus cycle. >>>> >>>> So if you use state_lock to protect pages_nr then you lose an atomic >>>> operation for the decrement and gain one (for the unlock) in the increment. >>>> That is even or maybe a slight gain. >>>> OTOH a 64bit atomic is a PITA on some 32bit systems. >>>> (In fact any atomic is a PITA on sparc32.) >>> >>> It's actually *stale_lock* and it's very misleading to use it for this. >>> I would actually like to keep atomics but I have no problem with >>> making it 32-bit for 32-bit systems. Would that work for you guys? >> >> It would be better to rename the lock. > > No it would not because that lock is protecting the list of entries > that could not be immediately freed. > Or could we use pool->lock to do this ? > ~Vitaly Vitaly, is the patch itself worth a Reviewed-by tag and go to the mm-tree ? Could this enhance discussed here be sent as another separate patch or am I supposed to make this change into the current patch? Many thanks for comment. > . >