Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1593354rdb; Mon, 2 Oct 2023 14:46:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFM+4w6zp/3RDLeoKFIFiBDw9qs6mRhEnbggJ5/oniUgCpuq94Dztrg2b7jrOCBjLnYl9iL X-Received: by 2002:a05:6122:c9c:b0:49d:120c:3c2a with SMTP id ba28-20020a0561220c9c00b0049d120c3c2amr8427264vkb.11.1696283194861; Mon, 02 Oct 2023 14:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696283194; cv=none; d=google.com; s=arc-20160816; b=VH3byfLzDno8MuA9J916MvsrxQFmShApiLzOWPd2AzVS13ZaYrwFbxJRals4NHPfJ3 5MoDzu9XdnWUbkvumAlrlUwOwanJJ+0g3GrVsNpy1baeGWH7gJDdqoz5fS/WPl6dk+Ts iD/0idEoArXlLtZVdm5u6/2WkcMwtlg0trLOn0lLts5cTB5PlL3HkkL1QPnQtYkmNR9w +LDNYW86Hu7vZpTETkP5OGWLCLx+LTB0LrlqlrZbXOoY/KbsXJ+UMS6nYaAmZcqYBoZG wYVTnGHM6gdMwTogeSuNgen4PCnsc7niMAHS1PjydNdpWMZveQ177XL1ITQ6kgDAhcBw Dehw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4O1ESocyKqwozJC+Tl+xGGPxeQyAnmMS0aCpZFUwmKo=; fh=fsktJKVOIKp3rZv7xQt4/CbSv8n44wxNo/VSozIIiYE=; b=gcEAcm0I/eYN8knBRmg/gEUglUVYyCBJdvHWwiHe4iZ87NzTzho36TkKJr+Ty/Jj0k MdNHv591LXk7Z4dWNsE5MAONrcy8QV5tYJdVXhB1v5WYs6PQ/BMcSYij3TH0Gbv68Qj4 fXwQ5aIDKjIG0HDTLog9zMRpbUgwiTyGSrXdjAO202EHtt+vU+VNVOY2oMsVHs+FWDLE aFBFgBwEBB2VpSxPlGrxaBUajQUM9GW8N8aGJipiFMWpSEW/5C1/e4WkucTB29ulMWAP 4xL1jm7jIsAwuD0oCqHbu4LoFU9ysI4JjXfwF5kj4ffynox6f5YegBgifz6CAgoL+6xd CQBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EVW6ugt+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id gx6-20020a17090b124600b002772ff87ee4si8572439pjb.82.2023.10.02.14.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 14:46:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EVW6ugt+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 41D89801B30A; Mon, 2 Oct 2023 08:24:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238078AbjJBPYC (ORCPT + 99 others); Mon, 2 Oct 2023 11:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238077AbjJBPYB (ORCPT ); Mon, 2 Oct 2023 11:24:01 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA035A6 for ; Mon, 2 Oct 2023 08:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696260191; 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: in-reply-to:in-reply-to:references:references; bh=4O1ESocyKqwozJC+Tl+xGGPxeQyAnmMS0aCpZFUwmKo=; b=EVW6ugt+WqYLDz2b3SDzOH0l9qPqzthtBM5nMs6tb2CBPtQyhEennpRBajU7zrJaPvzzq+ 9rnCVkXVVl2OJlOIHu35ue1+KlBzquVwSJeKJqTG3Nu9N9FuYNT/ZopcCSI+igOwHsQfVG wbLx9Rp0wUrJo4CmbFBYtP2uU8yrRZM= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-VuQFeq9UOCeV0GeuQ44Plg-1; Mon, 02 Oct 2023 11:23:09 -0400 X-MC-Unique: VuQFeq9UOCeV0GeuQ44Plg-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-4197878ffe9so12668071cf.0 for ; Mon, 02 Oct 2023 08:23:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696260189; x=1696864989; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4O1ESocyKqwozJC+Tl+xGGPxeQyAnmMS0aCpZFUwmKo=; b=pcGZh44EoXnI42SFOe72N89Ycjv/eVY4GL82kayhOsn1OF45tvZs0Q5PKy614s5nne aZrn6DFyaimpKFcGbGCpl8hkxa8BdXb339XAGHYE3baVSfqGAh69iPbdUrM3dXT7y7lp hgs9pzD8IwP7XrXCwzi05LoxMHnbc8kmkHYiXqk9toj9zZhTkq364LLiB4oRkCkAkT2G CWrmyPMZnPbSocqUnxNXwAZQrgtE56d4GKujtvZjmCs5BzsPKC6Vs0dcrzrRJevXdCSf SzXy3kjZLt4X8ha6EI4JmFIJJlrml5Mx0InMr9Z6EwNF7FGs97KgjF7KnasCQ350z1Ch IxWw== X-Gm-Message-State: AOJu0YwEMdWeMDppToJosfBby7zjBQx3ntDA8/rDqDbIdHCCC3qEu3nx GgN6fcZH4fwI+rz5GwIUjb5UOSyCXZdd4XgtFTWCJkd/djQDlh1DHypFgat3Yxj5ptfdMznw+wP J4MBe/hlTR20SskszjfbPQJXH X-Received: by 2002:a05:622a:1452:b0:3ff:2a6b:5a76 with SMTP id v18-20020a05622a145200b003ff2a6b5a76mr13928230qtx.5.1696260189226; Mon, 02 Oct 2023 08:23:09 -0700 (PDT) X-Received: by 2002:a05:622a:1452:b0:3ff:2a6b:5a76 with SMTP id v18-20020a05622a145200b003ff2a6b5a76mr13928199qtx.5.1696260188907; Mon, 02 Oct 2023 08:23:08 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id c21-20020ac853d5000000b004181d77e08fsm5406196qtq.85.2023.10.02.08.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 08:23:08 -0700 (PDT) Date: Mon, 2 Oct 2023 11:23:05 -0400 From: Peter Xu To: David Hildenbrand Cc: Suren Baghdasaryan , akpm@linux-foundation.org, viro@zeniv.linux.org.uk, brauner@kernel.org, shuah@kernel.org, aarcange@redhat.com, lokeshgidra@google.com, hughd@google.com, mhocko@suse.com, axelrasmussen@google.com, rppt@kernel.org, willy@infradead.org, Liam.Howlett@oracle.com, jannh@google.com, zhangpeng362@huawei.com, bgeffon@google.com, kaleshsingh@google.com, ngeoffray@google.com, jdduke@google.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 1/3] userfaultfd: UFFDIO_REMAP: rmap preparation Message-ID: References: <20230923013148.1390521-1-surenb@google.com> <20230923013148.1390521-2-surenb@google.com> <27f177c9-1035-3277-cd62-dc81c12acec4@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <27f177c9-1035-3277-cd62-dc81c12acec4@redhat.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 02 Oct 2023 08:24:15 -0700 (PDT) On Mon, Oct 02, 2023 at 04:42:50PM +0200, David Hildenbrand wrote: > On 23.09.23 03:31, Suren Baghdasaryan wrote: > > From: Andrea Arcangeli > > > > As far as the rmap code is concerned, UFFDIO_REMAP only alters the > > page->mapping and page->index. It does it while holding the page > > lock. However folio_referenced() is doing rmap walks without taking the > > folio lock first, so folio_lock_anon_vma_read() must be updated to > > re-check that the folio->mapping didn't change after we obtained the > > anon_vma read lock. > > I'm curious: why don't we need this for existing users of > page_move_anon_rmap()? What's special about UFFDIO_REMAP? Totally no expert on anon vma so I'm prone to errors, but IIUC the difference here is root anon vma cannot change in page_move_anon_rmap(), while UFFDIO_REMAP can. Thanks, -- Peter Xu