From patchwork Fri Aug 26 09:24:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12955710 Return-Path: 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 546ABECAAD2 for ; Fri, 26 Aug 2022 09:25:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 590A66B007D; Fri, 26 Aug 2022 05:24:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CF2D6B0085; Fri, 26 Aug 2022 05:24:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20EC06B007D; Fri, 26 Aug 2022 05:24:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D035A940007 for ; Fri, 26 Aug 2022 05:24:56 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B214B1A0226 for ; Fri, 26 Aug 2022 09:24:56 +0000 (UTC) X-FDA: 79841209392.06.7B5F1C5 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf03.hostedemail.com (Postfix) with ESMTP id 37F1A2000F for ; Fri, 26 Aug 2022 09:24:56 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MDZ9h3QwDzmV7R; Fri, 26 Aug 2022 17:22:32 +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; Fri, 26 Aug 2022 17:24:53 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH 05/10] hugetlb: Use helper {huge_pte|pmd}_lock() Date: Fri, 26 Aug 2022 17:24:17 +0800 Message-ID: <20220826092422.39591-6-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220826092422.39591-1-linmiaohe@huawei.com> References: <20220826092422.39591-1-linmiaohe@huawei.com> MIME-Version: 1.0 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661505896; a=rsa-sha256; cv=none; b=x1m3LJDhzi8HH+StXEVfY2gB7w+r3+biW8sHJZWfIq/LDOgtOSmIh4tDMiQh1Va2fykMjU FZV+dCLh3fp6NutO3CF+R5GRq/cU67JDH7RF5uN3vyn5LfGPztQee/oziyJ8S3EGwNycpu tEAFiGLWs3QqMwHv0Coguqcc+OS9mOg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661505896; 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=j0PEXFRxO14uZcf8BruBDTLxJoiNvn6qS4uW3Axl0B8=; b=gRqUfD77UjOsNhk9CoPAD0tJ2//reYgsjpJIDMi0poJevzrf0aNrj0kbjz/XAc/CK5loSH BkP1HQgOo0zVHOt9J1SShpznOSUzPYl65m440jgboHZRz4jTa3kXIZDIuhLO4oLmWzpsNg U3bRCxDkiHF3Dcn4w1bYkmnIgHDWYeA= Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-Rspamd-Queue-Id: 37F1A2000F X-Rspamd-Server: rspam08 X-Stat-Signature: tqr1izqr1m6ko154jg97z86s66tbfojn X-HE-Tag: 1661505896-864527 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: Use helper huge_pte_lock and pmd_lock to simplify the code. No functional change intended. Signed-off-by: Miaohe Lin Reviewed-by: Muchun Song --- mm/hugetlb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 06293da96112..6ea9f73aea84 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6094,8 +6094,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, page_in_pagecache = true; } - ptl = huge_pte_lockptr(h, dst_mm, dst_pte); - spin_lock(ptl); + ptl = huge_pte_lock(h, dst_mm, dst_pte); /* * We allow to overwrite a pte marker: consider when both MISSING|WP @@ -7176,8 +7175,7 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address, return NULL; retry: - ptl = pmd_lockptr(mm, pmd); - spin_lock(ptl); + ptl = pmd_lock(mm, pmd); /* * make sure that the address range covered by this pmd is not * unmapped from other threads.