Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4989248iob; Mon, 9 May 2022 06:25:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEoLjIcl+Xes/4JolwvGdguYQ8+u+yS57VXo42lyEOXaHHFAszBMSaEded7wYE2ap/0OVo X-Received: by 2002:a62:5c3:0:b0:50d:4274:4e9d with SMTP id 186-20020a6205c3000000b0050d42744e9dmr15726194pff.54.1652102702958; Mon, 09 May 2022 06:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652102702; cv=none; d=google.com; s=arc-20160816; b=y8fvJ3v7cmLT78uGa0GYW6TrDN5df9xA7KN9Je7wl3fZIceMd4ReW5FgSpniJgqexu qr4h8FD6wBNhWZGaRxvbO0G4aLcmfnd2EbM17dBFGH+bbgM1foe+rAZZv6grUOYlbXLh cxM9VIZGobyNSP60P+Bbvd+fbtWupvpkBdL9WJZVTBOtX74kLp2sbfl+vcF22YJBdCOf cOY9UnVUlyApp8oy/R2+yL3ehs5HGDaoQ6p+3WUF9WicHs7i+ogpFWqi/9irv6Ro2zN5 g9p5mH8h3sSjvsoOQfV1Jlm1VUVCfe0tfkHjV+fJX881Hk3QBjZxccWmXUYNCWe/WWOY YCzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xjseHqPTNVMEyNVjdH1pJ+MYe0tuLOxgYPuNYbAeTes=; b=MUgKBhGQqY+Sppss7kUU2KIXCtRLoNloBjwvx9yxQl6mlI52uIvelT2UPtuwV2pmol ulusH/pBwcL9g++I6jaovevCSC3yuEYnwyGRt7STLWlpnoxz7YXMudpyf7Xne6GazdUf Lb1ApGhesHP+8AHHtrsNtLivFHeClyVTsByujv8g/mO/HsJvpWzSoxDk9jHpPrthMm2K h09adM1QIYseWkoz3N3ydWoRJZ6tp8DFmSiM4f5Gd8crjKHR5hAAyTQPuC55Dvj7HsB6 B9/T6kqrdWGKXGaPXy7dLPf9eSEfcP7ZQ/0Tqw1vGWlNKPUGQM2bNxk5jRg/Qi+0eq+/ Bj3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l70-20020a638849000000b003ab77b8d779si13997080pgd.550.2022.05.09.06.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 06:25:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 85CE41AD59A; Mon, 9 May 2022 06:16:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235571AbiEINTT (ORCPT + 99 others); Mon, 9 May 2022 09:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235346AbiEINSG (ORCPT ); Mon, 9 May 2022 09:18:06 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C4162A83D8 for ; Mon, 9 May 2022 06:14:12 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KxhST2PfkzhZ3p; Mon, 9 May 2022 21:13:29 +0800 (CST) Received: from huawei.com (10.175.124.27) 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; Mon, 9 May 2022 21:14:04 +0800 From: Miaohe Lin To: CC: , , , , , , , , , , , Subject: [PATCH 09/15] mm/swap: avoid calling swp_swap_info when try to check SWP_STABLE_WRITES Date: Mon, 9 May 2022 21:14:10 +0800 Message-ID: <20220509131416.17553-10-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220509131416.17553-1-linmiaohe@huawei.com> References: <20220509131416.17553-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use flags of si directly to check SWP_STABLE_WRITES to avoid possible READ_ONCE and thus save some cpu cycles. Signed-off-by: Miaohe Lin --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 9c3e7e6ac202..89dd15504f3d 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3892,7 +3892,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) */ exclusive = true; } else if (exclusive && PageWriteback(page) && - (swp_swap_info(entry)->flags & SWP_STABLE_WRITES)) { + (si->flags & SWP_STABLE_WRITES)) { /* * This is tricky: not all swap backends support * concurrent page modifications while under writeback. -- 2.23.0