Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2174554lqt; Mon, 22 Apr 2024 03:52:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVXmSayaupbKRk0Q8RUVFr7VsKuZNpRRbq6k8gqZicno3P9RBC3pDDp4OAwnuY7N653GaeZhsUoSVZfFLtCn4b+TeN090isne3odFSBcw== X-Google-Smtp-Source: AGHT+IF0viOksloyLHEZ2wh4keBaAb76Aw7YARv6OTnX9JdPkGXXHZapHSyIPBcT93IOgM8QGaJR X-Received: by 2002:a17:906:6ad5:b0:a52:2c0e:2e91 with SMTP id q21-20020a1709066ad500b00a522c0e2e91mr6322292ejs.17.1713783177896; Mon, 22 Apr 2024 03:52:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713783177; cv=pass; d=google.com; s=arc-20160816; b=UHqdMHqX+i8ZYuIr9gmMxe/hbwKTukSmO6ke5FZw5uinqYPzUuurCYZd582GvSEaod vAPQCng9y9I2hhLP7IRT3ZPqkyDU9VnxBjVGPNAW+PR5CY54SG1GseeYkkJozx6P+mOT 8MKSqmHTAMJRMkDuwHFdZN3lXqKujq689JVNmbxP4Hjew26me4RcC0rLWAYsQ/Dx+fqy ypk6kzqQavZFLXDxsBy7NNxpNhWW557cbGpGbj3i/Y9vdqfpXO6uVDCQ72KptZKOcpuP Vxo010E7u/QBPR0W0ul5aWlcZ0IA7llRbFakigrxgrVdiJBsVeU0I7yhJE9NX4wo4SUR BKAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ESBueFFCicxxXb4Z+7ylQzVlc77asvp92RLfamr44V8=; fh=KPJjYJHLC+uLVMTRQa7GdG2CYCH/otyIF0MYaE50dhE=; b=Kl9dQkUpuctiIEWl+BOmibk83ujRnkZsuji7awd5fqvGyz3l4Wf3cClbin2GTIWANc bnSRc+nu1LS5uUhZypl+WPdMqoemEx6YaHkdoN+f2PKBw3WwwXkVpjcxZmtVAJ540QoF dXjT9xfCK638FFGMI/Oef2iGOGk5bDgE+lFjqU+5rkCigsBDPh0m+U/NCngkXJeA6ZR8 2HfCIkw8W2e0nvNOEjZkfeinGSRMpzwJa3gBPtvv3cl02K8rCDONTuP9D+aHN3omhLmz XPcfzJLrl8KOdd33vmBOLggdweueIzS9zl7T3rnqIoLeuQni2P+7fBzX2Hb6YnDgUDHY ZSmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=SofLs8EC; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-153237-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153237-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id me25-20020a170906aed900b00a519420028asi5470452ejb.266.2024.04.22.03.52.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 03:52:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153237-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=SofLs8EC; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-153237-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153237-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9CB841F21167 for ; Mon, 22 Apr 2024 10:52:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F765145340; Mon, 22 Apr 2024 10:52:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="SofLs8EC" Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAC26482C1 for ; Mon, 22 Apr 2024 10:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713783163; cv=none; b=m4pMaiik3DNRl9j+ZAktlO4DiavgGqwTXIhIfA1+VRt7GiyAaVR4y9tcxARRVrYdexu3mQBpElbrt1vfknAFph3vOc2Z1Au1M2eIcZTTADDXIBi6afuDo6B5qPlmfQpAZsKCIFQgQs7iGuCtd4HN2lnBs35DgZwT/dZ1moKDwKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713783163; c=relaxed/simple; bh=XDoMtI7bzd4H+3LWdrpe/D0kJlyFAvMW8N0fANSJKIY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=lgxIvZeaLYPeKndRlH70bvCdr/TKm+/URQNtpU4KG5zBwvzw2KxHPL0iNMcCLhZtmgm3zutiwu9XXfDN+plBk6bFoZrKsHAeMING1qkOzXO7OX4H6YRqn1Kg9E79cpYBWji3rResbx07WgJwAaLUMRZBbUCBLnqCGyoOgTvVmfQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=SofLs8EC; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1713783158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ESBueFFCicxxXb4Z+7ylQzVlc77asvp92RLfamr44V8=; b=SofLs8ECkVtz6Kcgh+S7ngLkJQLF/4Alo5ZBK/DZIM81VMdvqANwmxIw/JoYXVmLtD83AP j5tYXmAHSmQJypffgp1qUUJsoIyfR36wT6RiMmlmrrJn3vUUco6U/xH+p4b0XJ9woV4lkQ dkQ5Bjj+5/a9lsXcnA8cqJykoc0+zEU= From: Yajun Deng To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH] mm/rmap: remove unnecessary page_table_lock Date: Mon, 22 Apr 2024 18:52:12 +0800 Message-Id: <20240422105212.1485788-1-yajun.deng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT page_table_lock is a lock that for page table, we won't change page table in __anon_vma_prepare(). As we can see, it works well in anon_vma_clone(). They do the same operation. Remove unnecessary page_table_lock in __anon_vma_prepare(). Signed-off-by: Yajun Deng --- mm/rmap.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 2608c40dffad..e894640a9327 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -187,7 +187,6 @@ static void anon_vma_chain_link(struct vm_area_struct *vma, */ int __anon_vma_prepare(struct vm_area_struct *vma) { - struct mm_struct *mm = vma->vm_mm; struct anon_vma *anon_vma, *allocated; struct anon_vma_chain *avc; @@ -208,8 +207,6 @@ int __anon_vma_prepare(struct vm_area_struct *vma) } anon_vma_lock_write(anon_vma); - /* page_table_lock to protect against threads */ - spin_lock(&mm->page_table_lock); if (likely(!vma->anon_vma)) { vma->anon_vma = anon_vma; anon_vma_chain_link(vma, avc, anon_vma); @@ -217,7 +214,6 @@ int __anon_vma_prepare(struct vm_area_struct *vma) allocated = NULL; avc = NULL; } - spin_unlock(&mm->page_table_lock); anon_vma_unlock_write(anon_vma); if (unlikely(allocated)) -- 2.25.1