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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01F6DC433EF for ; Thu, 3 Mar 2022 02:27:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 715428D0002; Wed, 2 Mar 2022 21:27:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C3668D0001; Wed, 2 Mar 2022 21:27:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58B058D0002; Wed, 2 Mar 2022 21:27:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0129.hostedemail.com [216.40.44.129]) by kanga.kvack.org (Postfix) with ESMTP id 45CA58D0001 for ; Wed, 2 Mar 2022 21:27:20 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 00EDB181F6CBC for ; Thu, 3 Mar 2022 02:27:20 +0000 (UTC) X-FDA: 79201488240.20.0487DA3 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf17.hostedemail.com (Postfix) with ESMTP id EC00F40002 for ; Thu, 3 Mar 2022 02:27:18 +0000 (UTC) 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 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: EC00F40002 X-Stat-Signature: h5hfs1cmf7uhixefoz9hui1ojsrh1o7e Authentication-Results: imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-HE-Tag: 1646274438-863675 X-Bogosity: Ham, tests=bogofilter, spamicity=0.005445, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. > . >