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=-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 0E166C433E2 for ; Thu, 17 Sep 2020 11:58:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0CEB208DB for ; Thu, 17 Sep 2020 11:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726959AbgIQL5p convert rfc822-to-8bit (ORCPT ); Thu, 17 Sep 2020 07:57:45 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:3607 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726850AbgIQLyw (ORCPT ); Thu, 17 Sep 2020 07:54:52 -0400 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: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> 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 the 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.