Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3623046rwb; Tue, 16 Aug 2022 06:20:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR4LGDZvwuHWzgo+ssvnlPU8ZKqMuxS4c/sY7NKsDdsksCYvRA3xbtIgp1S3W4HdzPKOFVIY X-Received: by 2002:a17:906:ef8f:b0:731:4a01:7781 with SMTP id ze15-20020a170906ef8f00b007314a017781mr13831142ejb.268.1660656030811; Tue, 16 Aug 2022 06:20:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660656030; cv=none; d=google.com; s=arc-20160816; b=jpnHD7ACHmzCSoZiZfQyYpmZeIh/qpBOv36BMSoJF2wXijxmqIxLqVugmSLjxu59pz KXP2uiovzjdqa9IFrQtYF7R6h9b5aMKJZrS5l5cgaHReZ1pIJymyfcxyHw88wLQA/IC2 2AD8ThiLDLWL9AV8+0L4Yx64f2FzIFqRFmQskeWYPhneuIQZIxsHzk9zIshg5PIu67Hf MJmgPRtOCCxpROSI5jH5/hZcRKtvnHWbU3jI1u7IS/MQKXr8upIO4kHO0Tulr4rUE+Hn bPVqZ3zmtJGFCQ3A2ZAH6Df0ecrNJYhf8OKvyLkBMvgHawqqzMJ+Q93iRdIs6X8tFbJA 30NA== 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=FuN6T2p2RJ2CpDWMi2zsepaC0Qel6Up9shsoD+jS828=; b=WrwITOP/oZQiq0WlH7eUnE4Xzlyk058j0cQUGES3tQBbm7oNgaaReuNzj4lRnkkmtV mWqH28Z5+CIg9zoqntZAUfTF3WOd/kdtLdD6VgaqnbL1A5bOkMZAmfFrThlhPKJZHycq U/9XHdI4X7lznTN1wfGjK4UpIn3MeEKW6FdhBXQj3mNuz0cnBwLAbBoxxLBbmrjc8+pn MYsaE25XS8ReS2UzCsmYtNHwNRZX6Up+daHKwSSquvH5UULWTmWmLYZgRQcHVETxw7UW nA7rYT4pdayOBUVD3dQsVWOb+nfYNrGixObDWWbxdZwethxeAFWK2zy9wbDPa3mXXHH9 zLvg== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v23-20020a50d097000000b00435b2a66c73si9506946edd.191.2022.08.16.06.20.05; Tue, 16 Aug 2022 06:20:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234978AbiHPNGk (ORCPT + 99 others); Tue, 16 Aug 2022 09:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233961AbiHPNGX (ORCPT ); Tue, 16 Aug 2022 09:06:23 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B131A6396 for ; Tue, 16 Aug 2022 06:06:21 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4M6WY10B01zlVpm; Tue, 16 Aug 2022 21:03:17 +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; Tue, 16 Aug 2022 21:06:19 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 4/6] mm: hugetlb_vmemmap: add missing smp_wmb() before set_pte_at() Date: Tue, 16 Aug 2022 21:05:51 +0800 Message-ID: <20220816130553.31406-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220816130553.31406-1-linmiaohe@huawei.com> References: <20220816130553.31406-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: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 The memory barrier smp_wmb() is needed to make sure that preceding stores to the page contents become visible before the below set_pte_at() write. Signed-off-by: Miaohe Lin --- mm/hugetlb_vmemmap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index 20f414c0379f..76b2d03a0d8d 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -287,6 +287,11 @@ static void vmemmap_restore_pte(pte_t *pte, unsigned long addr, copy_page(to, (void *)walk->reuse_addr); reset_struct_pages(to); + /* + * Makes sure that preceding stores to the page contents become visible + * before the set_pte_at() write. + */ + smp_wmb(); set_pte_at(&init_mm, addr, pte, mk_pte(page, pgprot)); } -- 2.23.0