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 2DF03ECAAD2 for ; Sat, 27 Aug 2022 06:39:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 686EF940008; Sat, 27 Aug 2022 02:39:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 635BE940007; Sat, 27 Aug 2022 02:39:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52528940008; Sat, 27 Aug 2022 02:39:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 466A7940007 for ; Sat, 27 Aug 2022 02:39:01 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 22395120809 for ; Sat, 27 Aug 2022 06:39:01 +0000 (UTC) X-FDA: 79844420082.20.5DE0E74 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf06.hostedemail.com (Postfix) with ESMTP id 7329218001E for ; Sat, 27 Aug 2022 06:38:59 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MF6PQ43tnzYcqL; Sat, 27 Aug 2022 14:34:34 +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.2375.24; Sat, 27 Aug 2022 14:38:54 +0800 Subject: Re: [PATCH 03/10] hugetlb: Use LIST_HEAD() to define a list head To: Muchun Song CC: Andrew Morton , , Muchun Song , , References: <20220826092422.39591-1-linmiaohe@huawei.com> <20220826092422.39591-4-linmiaohe@huawei.com> <8D011A6F-F557-4519-852C-80BBDE53E630@linux.dev> <83DBE074-0B63-4CB2-9BD2-65967977B69C@linux.dev> From: Miaohe Lin Message-ID: <2339d458-8b98-f540-22f1-50b772eef130@huawei.com> Date: Sat, 27 Aug 2022 14:38:54 +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: <83DBE074-0B63-4CB2-9BD2-65967977B69C@linux.dev> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661582340; a=rsa-sha256; cv=none; b=DuTFMgXI4nvooWSVxKcU/l11IGdD9sKK8pcFjTmxWMe3HFzxOQaaZksxR5Wo+jH6F4EdvA iHpgS5GKWkt5MpH3YUJMaPWysy0bSbLrt9pQej/d7tA3+rC8CQSm3xxQACesjihIVnHvrt 2KnKvbUq2LJG6lkBR6J5FqoblgDo3aU= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661582340; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nQO2+PUYkdG9uTQ2rCCW8scJWKVZYMTtiEegg+OLetM=; b=jweQThlhXHcgyXTf7AeKPhDixuikP6By7Ia5NzFvseWLEcPxoUxhLsWI7TnKZZc/zxNg10 vRxrUY41BdEOJAzevXLfDGWGW+RWjDmbChR1X2JQyvwC7y4WixAOWile6IqfE3gLY7OKeb M2nPAjFHWSHwQDxcgKiJ6tYBO14Hg4I= X-Stat-Signature: abuzokf4dzcnfey1rkt311yghzuybwb5 X-Rspamd-Queue-Id: 7329218001E X-Rspam-User: X-Rspamd-Server: rspam06 Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-HE-Tag: 1661582339-128210 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/8/27 10:48, Muchun Song wrote: > > >> On Aug 27, 2022, at 10:27, Miaohe Lin wrote: >> >> On 2022/8/27 9:47, Muchun Song wrote: >>> >>> >>>> On Aug 26, 2022, at 17:24, Miaohe Lin wrote: >>>> >>>> We can avoid unneeded WRITE_ONCE() overhead by using LIST_HEAD() to define >>>> a list head. >>> >>> IIUC, the overhead doesn’t change. Right? >> >> I think the overhead is changed. LIST_HEAD is initialized without using WRITE_ONCE(): > > I think there is no special difference with "WRITE_ONCE(var, 0)" vs "var = 0” in It's not write var to 0 indeed. But there seems are no special difference. > assembly code. Both code of line will be compiled to a mov or movq instruction. > I didn’t confirm if the assembly code is different (I tend to think it is similar). > Just some analysis from me. I checked the generated code in x86, they're almost same. And in aarch64, there's difference between one "stp" instruction vs two "str" instruction. So I think you're right. Thanks for pointing this out. I should tweak the commit log in next version. Thanks a lot, Miaohe Lin