Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1093702pxb; Wed, 15 Sep 2021 22:36:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEwfa4YnQAEZMccFC4ENGc0OBC7LXBFIfdT/WG49axvInBL+mVIO5wvKs8BX+08hXEFoFJ X-Received: by 2002:a17:906:f74f:: with SMTP id jp15mr4338559ejb.423.1631770584015; Wed, 15 Sep 2021 22:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631770584; cv=none; d=google.com; s=arc-20160816; b=LegBIXmEN6pN6OxA6qFnsHTD3duF/TElGMun7Lp57dKrYOMf3rcsl8JNC4pTOPHV1c vuwoVcNEalOvM1eLyCzfiTmC1Nlo75UngudlYk57oEZ80NxbAa/0OtcFoqsl664SWCS7 TQjgaJNxU6aMdflibzf4Xvza9atdJnV4FRZobmCI95Y2jogK1feMH7i0piEixwRwR819 0u3TGSDvjq05Yu91Bgp+tWJwsIWvTicLOKwqa/Ic4HEn4XXdQJdp3pSZr1aFPYJhfcZT IJkvUWMSv983cw5WkDCvyupRWQgXcnxMHxx8jIV2fDsvBH6eZR+cGsz0BGAaPMgkBcSI omvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature; bh=lpQeXpJnDPLq9EM++SgX1hsrS2o8DK7oqXbcQuiENms=; b=Eflp9Qio6QvrV8GpPvpoyZuL1h5iF+9U+w5twIsRt35mWxa8rf67N/B7zsDzRhhlAK i2MLcGyP7S5E8jJbyxvt1O5n5zdhgFIJEYWUKfbaUwJI4+8Iw8Xajv1aIIeHFnMGW/ow MUlqg+oKv9u7NQAxppwbWezg4Oxt37jp0Ez8Ww2zWzcFDIjIsLI1VSTScnW6T6wvFJir ZlcBgdGF6KghSvwMMITesVL8BAomC0VgiwM9Ktd5JWBhPuOMTHWik0pYlI9othaNMllM G+5xQCYlPkkC0fxs8UT5hP2csz/SWBtB5r5NS9Bj2ES7kpap8OPmZV1EqOhjDPejfSr8 nVJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=dVuOTjqd; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si2378055eje.121.2021.09.15.22.35.59; Wed, 15 Sep 2021 22:36:24 -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=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=dVuOTjqd; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232716AbhIPFdo (ORCPT + 99 others); Thu, 16 Sep 2021 01:33:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233914AbhIPFdn (ORCPT ); Thu, 16 Sep 2021 01:33:43 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A04C7C061764 for ; Wed, 15 Sep 2021 22:32:23 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id j16so4879852pfc.2 for ; Wed, 15 Sep 2021 22:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=lpQeXpJnDPLq9EM++SgX1hsrS2o8DK7oqXbcQuiENms=; b=dVuOTjqdxMs7om2GBMnJW1JtJirdyLapvbyYqIaA0hSto0TKuv32C2H+M4lfHE+N8L EpBTiaPuVp9FrkviqdynL7lFW3P+hOtb6OcSR3elIgIC+9pUYEOO85zqTjLdQpuwd0wL 7bFne5kV0t7j1Onoz4HSFMwgwH9Am996EtkPCWhpu722UNu4Mav/xAvZiJLeF5+JwI5q Tzi9Vp+sG1UrVpl7CWqeklL8wKzdz74IOvO+olUpsm3x1WZGzUVLih3l7dz4CY55pzua 9NyFTgN9D6cIs7W/VUwYJNrp2QAQx6bgj6GewaLr97VyAHQSOzOgX454JDvmDcpMZhJF 04Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=lpQeXpJnDPLq9EM++SgX1hsrS2o8DK7oqXbcQuiENms=; b=TZVhbaeAt+Peol4vTzsbh0L+xZaI9mYgo44rb1gG6pLlm25V+sSwACtI1b4R9YpHOh AiuS52rsKT+xfMFdYX9AAwTsncGCIbrfZo4BRV8XUt11pZzS6Cf96J5fjtH80wu/AOe1 1yrsxCl9/44AxlJijIio75ZnpBRmspzPopvbVVV6bKEAW7qUUQiWHjW9fo0/lzjHm3UG arFqlhRi62zr0WfKRSjir7jIUHRlO/BFLgTijj5ua/kNaYdAvmAbBSVo5wUSi76x4BZ4 y+3TqjWJd/foeKbzax7/To8AbTl94gVmK1JTAt/Ph918PQ4CzDdggvhWcHhGol0EzR3Z ABQQ== X-Gm-Message-State: AOAM532lYwn+NYcpj2gLnbDfB8rp+tW/Ej88MsLSo7KKUd9dGyAog37N 2DKdJ6Aco/nWaCljnwgEnCY/yw== X-Received: by 2002:a63:f501:: with SMTP id w1mr3284849pgh.57.1631770343134; Wed, 15 Sep 2021 22:32:23 -0700 (PDT) Received: from [10.254.159.231] ([139.177.225.245]) by smtp.gmail.com with ESMTPSA id c15sm689474pfn.105.2021.09.15.22.32.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Sep 2021 22:32:22 -0700 (PDT) Subject: Re: [PATCH v2 0/9] Free user PTE page table pages To: Jason Gunthorpe 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 References: <20210819031858.98043-1-zhengqi.arch@bytedance.com> <5b9348fc-95fe-5be2-e9df-7c906e0c9b81@redhat.com> <41ceeec1-52c4-4e99-201c-e1e05b2afbbc@bytedance.com> <20210915145933.GH3544071@ziepe.ca> From: Qi Zheng Message-ID: Date: Thu, 16 Sep 2021 13:32:17 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210915145933.GH3544071@ziepe.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/15/21 10:59 PM, Jason Gunthorpe wrote: > 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. Yes, I will search pte_offset_map()/pmd_trans_unstable/etc, and then analyze the specific situation. > > When you get to step 3 you just change pte_try_map() and the callsites > don't need changing. > > Jason > Thanks, Qi