Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2779211lqt; Tue, 23 Apr 2024 00:53:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWO0EiSylpq6tZ6uTq+YGeQaXXgOdDHbusYn7KmCLRTqYvo2Nsc6qJjz4qTjG1alFql6dikD537aWDWg9460e2xxfn7H1/coOVvc2lJmg== X-Google-Smtp-Source: AGHT+IEqBSpk3x2guttlYkCBj3rm9vuDd436veN7QkZF5ipPoLmZ/E//E51fIGJpUW/ByC28vYeD X-Received: by 2002:a05:6358:5d88:b0:186:b6ac:8ce1 with SMTP id s8-20020a0563585d8800b00186b6ac8ce1mr16629744rwm.22.1713858824023; Tue, 23 Apr 2024 00:53:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713858823; cv=pass; d=google.com; s=arc-20160816; b=zWGMl+g0lTIMhtTL5u/i/kYqDFytmu9E1XY1ZhOe5wA3Lqt54ZdK+Pcg8ipmD082Hk zDJqfKxvFMIbN9ITqZ78546zGhCAfb+5dA7LwdSzhq+1roIyez5TJSKXhHuvXnn9U68a yvPdHHCCSMo6J4R0vJiKX21Y9svMBN+qYCxkIw8hnrdnTdR5l4+M8OQ4nzJBuV5dwDQD h2noKapf9PThyLI18dFUinY873CQl5JBTOnFMr3VvvspU67NtihroW8nhEtFrmOGL1Ql xN1q5T55fHuZ3xwmIWHLAdBUfgZEIiM4D4N/ezY1aMUK4CsxbHQRcajd20IzysSXhZ36 uHfA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:cc:to:subject:tls-required:message-id:from :content-transfer-encoding:date:dkim-signature:mime-version :list-unsubscribe:list-subscribe:list-id:precedence; bh=vjYIax7W2T2XC/0OrrkmBtCx2ko2ZCZN2ZtWHto1d7Y=; fh=pRbuoJgTuQE409qHF8lwcTp37KTOnQ6ZypH7nkZCOk0=; b=NFotmcW29pzm/8NDz2wvFJHJ5F0XTxdCiizJSQAL2bfMdQAFx2slu825Et6rNJpMxJ XEKvJseu+mYowkkGJk7D5eGohv8Su/a6TrJak0/KJxIiKn5EGTSeu61/FaYpQ+894Sm8 tlJ7g3sOWurEhIJaOmany2qbMf5a6xyGQfeRpygrzv+/orOIEnOeZU4/ZlM5/o3EPuAI d0CwHl1Ula11tQsecBV37geCKgwgYqzjTJ9T22onpGNeHs0kRsVaAKE+w2DMwVd7kJ3H h+jqjqu7n1mEMptLfQm3lrX/W18WtkmvcyAq6yXidzfTr6oR4pyU8UNbEps5sUoHVJv1 /9ug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="p5g5M1/X"; 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-154630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154630-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o20-20020a63f154000000b005f0c099624dsi9102301pgk.81.2024.04.23.00.53.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 00:53:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="p5g5M1/X"; 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-154630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154630-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B1A44B223B6 for ; Tue, 23 Apr 2024 07:53:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7F5C482D7; Tue, 23 Apr 2024 07:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="p5g5M1/X" Received: from out-185.mta1.migadu.com (out-185.mta1.migadu.com [95.215.58.185]) (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 F102946522 for ; Tue, 23 Apr 2024 07:53:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.185 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713858811; cv=none; b=TQkuz3cpAQ7LUvwtJPdem0PRUTQReYOKN730q0loikw0HxWlx3hBroitxlsnVuFml4csFMq53+FIPj7x26Wl1Sb6M0QZ4QuT9r87/r0q4ukRjlXAbxewxrCi8tPnckhnvFoeY4wY4Oy+rKKYZbeyFEzO/hJqitQ6sCQlW9E2a9s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713858811; c=relaxed/simple; bh=2uRvhIeBa7+qSWT0hhZnPL7Y55HU9vEDWEPpAdr2fHE=; h=MIME-Version:Date:Content-Type:From:Message-ID:Subject:To:Cc: In-Reply-To:References; b=gx7UgMbtMLekl7wMo10HHwAUfF+oCwoyr+9PhhsUuKSRTUYAq29TNp89fZSNJgfKvdym8d81R9TAyNZXOHWF071uP5bJDFzpSGa4ELPCg9GbUEd4zDQVkN6E8gx9ZvqxgfP08o1K0owHMaCyRi26msaVM9kXVQyNeXGi3qY0Nhs= 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=p5g5M1/X; arc=none smtp.client-ip=95.215.58.185 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1713858807; h=from:from: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=vjYIax7W2T2XC/0OrrkmBtCx2ko2ZCZN2ZtWHto1d7Y=; b=p5g5M1/XsEW7m/OL6Z0aOouGOrbnunRC+/rMqiD9Nj7fj+3x/IHod3cl1rRXE9b2Vz+moQ yIl5LP6231Hbpbb9vEHhea+RyvvvugTUuBQ5pj1kseX+E6255ZyXqa1sCcQPNBaxNJ1aU9 pN67PtoralP8LZsc6GhxRuOmMkfipmM= Date: Tue, 23 Apr 2024 07:53:24 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Yajun Deng" Message-ID: <3c452d5db5b3d5879160ab62a9e0ac4481a6298a@linux.dev> TLS-Required: No Subject: Re: [PATCH] mm/rmap: remove unnecessary page_table_lock To: "David Hildenbrand" , akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org In-Reply-To: References: <20240422105212.1485788-1-yajun.deng@linux.dev> X-Migadu-Flow: FLOW_OUT April 22, 2024 at 7:24 PM, "David Hildenbrand" wrote: >=20 >=20On 22.04.24 12:52, Yajun Deng wrote: >=20 >=20>=20 >=20> page_table_lock is a lock that for page table, we won't change page > >=20 >=20> table in __anon_vma_prepare(). As we can see, it works well in > >=20 >=20> anon_vma_clone(). They do the same operation. > >=20 >=20 > We are reusing mm->page_table_lock to serialize, not the *actual* low-l= evel page table locks that really protect PTEs. >=20 >=20With that locking gone, there would be nothing protection vma->anon_v= ma. >=20 >=20Note that anon_vma_clone() is likely called with the mmap_lock held i= n write mode, which is not the case for __anon_vma_prepare() ... Yes, anon_vma_clone() is called with the mmap_lock held. I added mmap_ass= ert_write_locked(dst->vm_mm) to prove it. I added mmap_assert_write_locked(vma->vm_mm) in __anon_vma_prepare() at t= he same time, it shows __anon_vma_prepare() is also called with the mmap_lock held too. >=20 >=20I think this change is wrong. >=20 >=20-- Cheers, >=20 >=20David / dhildenb >