From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B54DC433EF for ; Wed, 15 Sep 2021 14:59:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C3EB861355 for ; Wed, 15 Sep 2021 14:59:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C3EB861355 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id BF4356B0071; Wed, 15 Sep 2021 10:59:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B7C556B0072; Wed, 15 Sep 2021 10:59:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F61D6B0073; Wed, 15 Sep 2021 10:59:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 897DC6B0071 for ; Wed, 15 Sep 2021 10:59:37 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 024B782499A8 for ; Wed, 15 Sep 2021 14:59:36 +0000 (UTC) X-FDA: 78590116794.29.8A9E320 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by imf11.hostedemail.com (Postfix) with ESMTP id 26F52F000201 for ; Wed, 15 Sep 2021 14:59:36 +0000 (UTC) Received: by mail-qv1-f47.google.com with SMTP id w8so2089727qvt.0 for ; Wed, 15 Sep 2021 07:59:35 -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=5xtuTAMQbPaBtjUckffN2sxjdbzaicoTpMlLy41eELomSvNHK5R1SriL5GMzlNQxwV xPnHrzimabK7/aUpGIe325HGxxzsk2UHVU/MW5cozXJvBUdogTzgN6bDGZ4Gtimb3YGE VFveFZIENL1I5tp0ZscU34Jayq4mZmogdqRC6mxff0v3qSWVHdElHT1AoQVDdHkJ8K9D Fj2JgQLRcZR1sAbrio1k1mu1JvDZUffS/GKj0QAYubAWW3a4B9jE7N3zq7sQ3viRarQB echyNoy5ZJ07Hpf7c0u8+PhPe3fa/FRe/fQ5EiGutUBqVgeMw/9LzwXeM6kPdgkdleL+ ydLw== X-Gm-Message-State: AOAM530t4dSdvRCdWcm+5SAAKWK8fOa5JNQFYCn+aTWq3SJb+zQymJ2F GWVQorl8+LGUChQlfGD1Px8v9A== X-Google-Smtp-Source: ABdhPJwRB1i8P/5MUsqecQu4H3LUbFlyF2TgQTNcjPoCkKhtdYqz9bQtL7i0zMYAUUN3+WsBh6P3RA== 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> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 26F52F000201 X-Stat-Signature: r97pkddam3m9goxgtapu9fkcuqi5ffuu Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b=Bp8gUfAr; spf=pass (imf11.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.219.47 as permitted sender) smtp.mailfrom=jgg@ziepe.ca; dmarc=none X-HE-Tag: 1631717976-660983 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: 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