Message ID | 20220704132201.14611-3-linmiaohe@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 B5B64C43334 for <linux-mm@archiver.kernel.org>; Mon, 4 Jul 2022 13:22:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 72D6D6B0075; Mon, 4 Jul 2022 09:22:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 61D396B0074; Mon, 4 Jul 2022 09:22:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 46EE66B007B; Mon, 4 Jul 2022 09:22:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2D46B6B0074 for <linux-mm@kvack.org>; Mon, 4 Jul 2022 09:22:16 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 073BD802BD for <linux-mm@kvack.org>; Mon, 4 Jul 2022 13:22:16 +0000 (UTC) X-FDA: 79649481072.31.9A6BB0E Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf20.hostedemail.com (Postfix) with ESMTP id 673E51C004C for <linux-mm@kvack.org>; Mon, 4 Jul 2022 13:22:15 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Lc5wX1FZqzTgWr; Mon, 4 Jul 2022 21:18:36 +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, 4 Jul 2022 21:22:10 +0800 From: Miaohe Lin <linmiaohe@huawei.com> To: <akpm@linux-foundation.org> CC: <shy828301@gmail.com>, <willy@infradead.org>, <zokeefe@google.com>, <songmuchun@bytedance.com>, <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com> Subject: [PATCH v3 02/16] mm/huge_memory: access vm_page_prot with READ_ONCE in remove_migration_pmd Date: Mon, 4 Jul 2022 21:21:47 +0800 Message-ID: <20220704132201.14611-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220704132201.14611-1-linmiaohe@huawei.com> References: <20220704132201.14611-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656940935; 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=qxlrQq8tazFnfwy9DbvAwZNIpRhTOeKdOtlhHSc7boM=; b=7HfYLdKIVCR2dw2R8XR0KHVFFyLwG/2sVDQ465PM/sLW9QEoU8+Ke6xjjzIrdOBGaqPXZf L3iznPwFQmdBCpyC0BuvhhtaPHN5EG+FDXnTNKpIJsP+kwak0fYxw4smQTCZCbGKDZH9xZ AV1dw0j6CYTG6OAQq1gMMU1LbcGlYV0= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656940935; a=rsa-sha256; cv=none; b=BTMbtE6dKq4shWkuovMzh+gOupa/VlaG4Y4fcinidFBN7LuSUTml1rWWCJw+J4aECaLeha DGg1g106kbqpr22dCCRlzqPPHnLqYUp4qkyNH5ggGHNWLs/EB4Dh/dNIJzncQ/D1ILx4Lq iZ4yFTDy3ALS2X11xUqDWGwo8aymLxw= Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 673E51C004C X-Stat-Signature: jhn1iuwukj4cpq4chhj99ddroymj4bd5 X-Rspam-User: X-HE-Tag: 1656940935-478756 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: <linux-mm.kvack.org> |
Series |
A few cleanup patches for huge_memory
|
expand
|
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index f4e581eefb67..a010f9ba15ce 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3309,7 +3309,7 @@ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new) entry = pmd_to_swp_entry(*pvmw->pmd); get_page(new); - pmde = pmd_mkold(mk_huge_pmd(new, vma->vm_page_prot)); + pmde = pmd_mkold(mk_huge_pmd(new, READ_ONCE(vma->vm_page_prot))); if (pmd_swp_soft_dirty(*pvmw->pmd)) pmde = pmd_mksoft_dirty(pmde); if (is_writable_migration_entry(entry))
vma->vm_page_prot is read lockless from the rmap_walk, it may be updated concurrently. Using READ_ONCE to prevent the risk of reading intermediate values. Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)