From patchwork Thu Sep 1 12:00:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12962363 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 96F3EECAAD3 for ; Thu, 1 Sep 2022 12:01:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B00DE8D0009; Thu, 1 Sep 2022 08:01:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9ECD98D000C; Thu, 1 Sep 2022 08:01:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 666D68D0003; Thu, 1 Sep 2022 08:01:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3FBB58D0009 for ; Thu, 1 Sep 2022 08:01:11 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1DB80121011 for ; Thu, 1 Sep 2022 12:01:11 +0000 (UTC) X-FDA: 79863375942.19.F48BB13 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf07.hostedemail.com (Postfix) with ESMTP id 236AA40077 for ; Thu, 1 Sep 2022 12:01:06 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJKM00RcLznTvS; Thu, 1 Sep 2022 19:58: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; Thu, 1 Sep 2022 20:01:03 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH v2 05/10] hugetlb: Use helper {huge_pte|pmd}_lock() Date: Thu, 1 Sep 2022 20:00:25 +0800 Message-ID: <20220901120030.63318-6-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220901120030.63318-1-linmiaohe@huawei.com> References: <20220901120030.63318-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662033667; a=rsa-sha256; cv=none; b=TsMF5YA3vDUP7oY0hPvcT1+6Q8/RGEmiV2GvMqYMG8bR45ugGOjV7CGqBfPofVJJ7Uq1bF pNxNcAw0ErJnxqdYSmhhOR+TdmTR1tzHjiNDAlsSFEGFRCGOXu8ALNzF4BFuB9SFili3IU tSNgboIHRMWABysW+4G4ux9dDPHcrvI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662033667; 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=eZsJgNC1fSK4UeCPmIT8G8sqOcUNpggy0/NAGgeBvMA=; b=EalPIbmnUtUz+/vfjXFJEQXwRBwsUNqMjIjJfh/E0/lwF4AS37IyaPo4evRliNZMi97iDc oHRBO21etayINmpwiufIbFyYulBGKfuLTHvC7PVGROzSxUl0L6fk8qG00U95rP6xoxu7SD CgY/7BoWpiUzKWzj6iYtvYkY3oAP/c4= X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 236AA40077 X-Stat-Signature: zph134jat48j7wsa5rt6xhbsim81nc7x Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-HE-Tag: 1662033666-113987 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 c29b444a5515..d35381de90c3 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.