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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 F319DC433E2 for ; Thu, 17 Sep 2020 11:54:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8A2CC208DB for ; Thu, 17 Sep 2020 11:54:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A2CC208DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EE7A76B0003; Thu, 17 Sep 2020 07:54:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E974C6B0037; Thu, 17 Sep 2020 07:54:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAD596B0055; Thu, 17 Sep 2020 07:54:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0178.hostedemail.com [216.40.44.178]) by kanga.kvack.org (Postfix) with ESMTP id C4DB86B0003 for ; Thu, 17 Sep 2020 07:54:50 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8B92C362B for ; Thu, 17 Sep 2020 11:54:50 +0000 (UTC) X-FDA: 77272396740.04.crown20_080a56d27122 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 540AC800E2C2 for ; Thu, 17 Sep 2020 11:54:50 +0000 (UTC) X-HE-Tag: crown20_080a56d27122 X-Filterd-Recvd-Size: 2107 Received: from huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 11:54:49 +0000 (UTC) Received: from dggeme754-chm.china.huawei.com (unknown [172.30.72.57]) by Forcepoint Email with ESMTP id F2794487DE71E8F30B73; Thu, 17 Sep 2020 19:54:43 +0800 (CST) Received: from dggeme753-chm.china.huawei.com (10.3.19.99) by dggeme754-chm.china.huawei.com (10.3.19.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Thu, 17 Sep 2020 19:54:43 +0800 Received: from dggeme753-chm.china.huawei.com ([10.7.64.70]) by dggeme753-chm.china.huawei.com ([10.7.64.70]) with mapi id 15.01.1913.007; Thu, 17 Sep 2020 19:54:43 +0800 From: linmiaohe To: Matthew Wilcox CC: "akpm@linux-foundation.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] mm: avoid possible multiple call to swap_node() Thread-Topic: [PATCH] mm: avoid possible multiple call to swap_node() Thread-Index: AdaM6Oe6eaYOLUj9SMWV/0KAXRUceQ== Date: Thu, 17 Sep 2020 11:54:43 +0000 Message-ID: <691578e1e0844c7c876a54c6ff9c2f0a@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.176.109] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 540AC800E2C2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: Matthew Wilcox wrote: > On Thu, Sep 17, 2020 at 07:44:49AM -0400, Miaohe Lin wrote: >> Cache the swap_node() in a local variable to avoid possible multiple=20 >> call to swap_node(), though compiler may do this for us. > >Why don't you find out? Compare the assembly before and after, see what t= he compiler did. In fact, I don't care if the compiler can really do this for us. I think it= 's better to do this explicity. I think this can improve the readability. Thanks.