Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp549841pxb; Wed, 15 Sep 2021 08:01:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxycRtoyNhLtMz+R8ohrYi4M9UvKG/kwZrjlnXBsr6L+zRvEQGeE6NwPlIVoNy9OIrUPBgw X-Received: by 2002:a05:6512:3f8c:: with SMTP id x12mr275190lfa.320.1631718091870; Wed, 15 Sep 2021 08:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631718091; cv=none; d=google.com; s=arc-20160816; b=e+kmQrH/uSvbGN8UmBFXfY0Znq5KvGidBy8wrgK7TyB2BsRsVEE6vcLtSzx1ZCJ8SX R6sBAzmCuGaiMroxC9B3d2tBhbU0XH58qkBAPoih9YjpnzxKvs7jr/oos7xoWVZJ5dNE TiHw6gN+3K69kw/0gJzUzJuuZT4LWTz+H6nge4fuMxZm9cc2o2ATPTZylMdDLJol/y2D kqmI5BrjpY5/+1Fk9tHozhrxPuH6F3uKc273D2wb26vV/U/pXt2GcaoUfCFqHF7VDvag n0sMNrOW5r5nDwKDUDCFraXhvCkkCyaUl7Y9z000sTnwYlHJVs1gjx4SQd8k1/mYNe0u QSEA== 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=P573y5Vc2zJUuuf0RRwx4Cvk5IBWAT6Ne62UqhX4bYU=; b=iWJEdm2Y50XGw9uDSiusb+96ctJOuw184OBz/1PSAwQS0QORW9BxRHg/AqLnDjztVi zxeg2GWDjj6CN2NxmJd499B6/ayvgpDiNOoyZC04AAxBeQkjjTKPUBBHccPc5xlR7kFs SUoJdx3wTxGb2OM9UudWL0kefGdmVTfDeChudCGTbbRucT65pqYNmCMPPnEOT0KIYfxN CH+ZWCpbyHq7gng4JPRd9E9+d37/P2ynVqxgPwbGuvj0/cIYlFYtlCp5dYG7Q0wKeaLB qz1EulhdaijzSyrkzVVjwQPTsUGpwBkA6c0EaMTKx9nQmC7alVhPqNW0HvHhP0e1VNq8 4+Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Bp8gUfAr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 10si125875ejw.91.2021.09.15.08.01.05; Wed, 15 Sep 2021 08:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Bp8gUfAr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233901AbhIOPAz (ORCPT + 99 others); Wed, 15 Sep 2021 11:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234011AbhIOPAz (ORCPT ); Wed, 15 Sep 2021 11:00:55 -0400 Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 246ACC061574 for ; Wed, 15 Sep 2021 07:59:36 -0700 (PDT) Received: by mail-qv1-xf29.google.com with SMTP id cf2so2024998qvb.10 for ; Wed, 15 Sep 2021 07:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=P573y5Vc2zJUuuf0RRwx4Cvk5IBWAT6Ne62UqhX4bYU=; b=Bp8gUfAr1azAr/3FG2yM2/cwGeN6T4EF5Krx23caRq0ZMdS/q4W2WTqsWqzmgzLUT+ +xXlZtuf+NA6/DWKxdwEdKEsocN/RrK8k9lEeUdsAk8FcZjEN/btABeccOE0wTk823zB A/Tpg/hqHk5Mw/HAhH+KsdpqQFtHKA3thT66fVa5NDlsQpaZyBwLmfYL7QpYL+2Y8yyi zyKebTydIhoK7/yWuSq/LKJVoLly0v26Pg7hecQ1bLZkmLmKsbSuqzNaydUXvAYqw/TN LpcxqhDbyosCIwX64guMvOY8QulPBTYRVucJPuSMt1hXQBFvDvQu3JU0WUIX0Snaqsrm Dg2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=P573y5Vc2zJUuuf0RRwx4Cvk5IBWAT6Ne62UqhX4bYU=; b=wz7eoZC2HgT9xq4Gm1KhA+d4PTr9YjsbmYTdQm0thBxkX9iyiGyaRQqLDosKHSv6YP sbsFD6HxauuqnGwamqE4AQwz75aoz0XV+oXAWqo8FnAYQR9+9YBUFDLBxqJut9gzRbp3 5y2IsztRJG0UHLvvhDSNfoTt1gLEBTNjfWsEs1rlgInXo1Szexkuw3NjyoJFVMaVx23+ uF5cN5cO6hAVmkSFFrm14GqERiWyU/6RjnIwmQdQs4ca1HKTyfNhvPvCRPNyXsNRXye2 g/DIMHPBCaA07V7/OLFlh5AUqWlqMAL8WL+/tzq/ZNCitNAwbQRIJdanzf/8zMZ52qoQ 4Vmg== X-Gm-Message-State: AOAM530rHS/lpX6SXq05PeYQAlglcffwMIboH/xwJQsv5e7A3pNbf1uP kvzPunPkP5sPfVAVjbgcEWAcaQ== X-Received: by 2002:ad4:436b:: with SMTP id u11mr138020qvt.26.1631717975370; Wed, 15 Sep 2021 07:59:35 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id b12sm166578qkk.3.2021.09.15.07.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 07:59:34 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mQWNp-000zui-M1; Wed, 15 Sep 2021 11:59:33 -0300 Date: Wed, 15 Sep 2021 11:59:33 -0300 From: Jason Gunthorpe To: Qi Zheng Cc: David Hildenbrand , akpm@linux-foundation.org, tglx@linutronix.de, hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, kirill.shutemov@linux.intel.com, mika.penttila@nextfour.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, songmuchun@bytedance.com Subject: Re: [PATCH v2 0/9] Free user PTE page table pages Message-ID: <20210915145933.GH3544071@ziepe.ca> References: <20210819031858.98043-1-zhengqi.arch@bytedance.com> <5b9348fc-95fe-5be2-e9df-7c906e0c9b81@redhat.com> <41ceeec1-52c4-4e99-201c-e1e05b2afbbc@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41ceeec1-52c4-4e99-201c-e1e05b2afbbc@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 10:52:40PM +0800, Qi Zheng wrote: > I am going to split this patch series as follows: > > 1. Introduce the new dummy APIs, which is an empty implementation. > But I will explain its semantics. > 2. Merge #6, #7 and #8, and call these dummy APIs in any necessary > location, and split some special cases into single patches, such as > pagefault and gup, etc. So that we can explain in more detail the > concurrency in these cases. For example, we don't need to hold any > pte_refcount in the fast path in gup on the x86_64 platform. Because > the PTE page can't be freed after the local CPU interrupt is closed > in the fast path in gup. > 3. Introduce CONFIG_FREE_USER_PTE and implement these empty dummy APIs. > 4. Add a description document. > > And I try to add a function that combines pte_offset_map() and > pte_try_get(). Maybe the func name is pte_try_map() recommended by > Jason, or keep the pte_offset_map() unchanged? It is part of the transformation, add a pte_try_map()/pte_undo_try_map() and replace all the pte_offset_map() callsites that can use the new API with it. The idea was that try_map would incorporate the pmd_trans_unstable/etc mess so searching for trans_unstable is a good place to start finding candidates. Some are simple, some are tricky. When you get to step 3 you just change pte_try_map() and the callsites don't need changing. Jason