Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp232348pxb; Thu, 2 Sep 2021 02:58:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWfhsmdM7BJG0x0q6UQbNrZI0WyRaV49fFzf+8F96zK5cfJj/eo6mY5mOcGvchpCRZL/hg X-Received: by 2002:a5e:dd42:: with SMTP id u2mr2144925iop.157.1630576724356; Thu, 02 Sep 2021 02:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630576724; cv=none; d=google.com; s=arc-20160816; b=dM1susAUb7XYpGd7dVHiUTJNApc402Q09s6bi4f0E6YmD/yhcdbkgAnvDc2UiG0KMH NFpfxWZNwhu2mZU+MeXlqqmO+S1bhWR6cR/L90KUEK5d2A65g4PSCI4TeR+bQIfbWsHT JEGWOICfR9vh8WqgBDcCME5Cc93x23ovntTyh9QmjUYOdsaY1iKEoVaPB9dKjkgwXoIK CbAqxsiL8Qb0+R8gTVHXL6eHrKK4Q12O07m8++R0kXYnh7blUvBEqYVE/zKeJl9h/a0V 1RfNboIoLFL8giERFB7EpQTT25BxIvxgYlKlt+sWPvXk82gVgLKEqlqj+XzZXmUNg60B FlSg== 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=Gjsbot1Ioib4U7AgvUadDJqCoxn0LGYzazPWjhiFe6A=; b=SguoxwH/Liq5qVGc4Ah0dEcz6cgeyq08Amh5Z8g/qDm4dr1ZB9q2WMeduilWDAa+S3 OOmpQTrXL0cKsx1FkKOOeIJoO4kvamFjlghTKsEHRBdNfoAB0InN8AifD7hGwQL3yXB1 1DlzQYWAkQUNq2uEUmGWagHqiPs11qXKbumfXfWHl56zzrHt8mLAwcRZsd6Pe9hV0Gpl DotPuPu8cvLDeHBT3cqCe5TFJu2VIFuENPbYjob0gTO10Xw/QalfCELePrvO4aZx+6d/ SDrw7nVNF8EzuN2tUoL1BD/hGZteh3WDrQZqP3lgycQsA1AyjHYL6CA41w1+BAP9QRtY wGhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=E3ouvM0y; 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 u2si1492806ioc.87.2021.09.02.02.58.33; Thu, 02 Sep 2021 02:58:44 -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=E3ouvM0y; 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 S241191AbhIBGzG (ORCPT + 99 others); Thu, 2 Sep 2021 02:55:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233363AbhIBGzD (ORCPT ); Thu, 2 Sep 2021 02:55:03 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC60AC061575 for ; Wed, 1 Sep 2021 23:54:05 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id e7so572373plh.8 for ; Wed, 01 Sep 2021 23:54:05 -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=Gjsbot1Ioib4U7AgvUadDJqCoxn0LGYzazPWjhiFe6A=; b=E3ouvM0ynVSTIUIqv7WlfcuLv7HFqUAlSQpDXOp9Hxbpq8gdlW9eTQw9XctxC0StvE kVzh3iVDyHB0lHCqASPPabxBWhTOXi7Dp7Qc2O/RHUfsetZzhMXdr1gedzUqbxfHwX6j LLgWQF90UCcPawQ115M+8DzGAotfDwmPuQXPrpqU330j1lOxHGXCWbSefY0zZgL8gLeA mf7kL7nm0rU4b6pfim3HmjCiZRWAISzh0KRyySgKjU2ySFlkBphYlPeCKDPp6v/xDtDV gPS/L48Qnr+bFH38DKNYPDBjl63nDmXBqkyeSqm0gESKa4YIZ8ggOiJbNLJC4REoEGET LT8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Gjsbot1Ioib4U7AgvUadDJqCoxn0LGYzazPWjhiFe6A=; b=gky/CnvX5z0cVBZulN+DAiw0cqqfzfZH177BLregU/5Swy6O4Xmcd04cK4Zi5FW21V ylFtVi+KeIAeb2Ma1VoIxXgJnMjeM/DLlgUqyReTgnWbvBjpPlU8VltlfaTYttNNO6eG sPi9tIUoBKaivIpjt+wXczfXHyJNsTgSxIvYLCVvOt1gnYq9O/tUe0YQ/16EMrEWGvfx qb5cfBobKQ09DRtpzpFyVIVYJyXNrGXb3ipmJO+BtO9f489/Fqdl2vILS0UbNdSNzhsT x5hHk6rfYm4Iv24o7+cGV3+3Q0LNBeSrZiAoAL3/lokN0KltyQVuZhb0Ndr8SUx75Rlq I7Sg== X-Gm-Message-State: AOAM532cke31z35svakpm6a922qEmoxho2Mx559Fb1qRLSp4V5X1bKRd 8vY6tHOtGMruy8BCcTw1ZRGf9Q== X-Received: by 2002:a17:90a:3f83:: with SMTP id m3mr2106262pjc.46.1630565644875; Wed, 01 Sep 2021 23:54:04 -0700 (PDT) Received: from [10.254.207.253] ([139.177.225.243]) by smtp.gmail.com with ESMTPSA id p34sm1354810pgb.14.2021.09.01.23.54.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Sep 2021 23:54:04 -0700 (PDT) Subject: Re: [PATCH v2 6/9] mm: free user PTE page table pages To: Jason Gunthorpe , David Hildenbrand Cc: 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> <20210819031858.98043-7-zhengqi.arch@bytedance.com> <20210901135314.GA1859446@nvidia.com> <0c9766c9-6e8b-5445-83dc-9f2b71a76b4f@redhat.com> <20210901153247.GJ1721383@nvidia.com> From: Qi Zheng Message-ID: <47c7d6fd-056b-0e40-ae30-e2f099a97a95@bytedance.com> Date: Thu, 2 Sep 2021 14:53:58 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210901153247.GJ1721383@nvidia.com> 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 2021/9/1 PM11:32, Jason Gunthorpe wrote: > >>> Also, I don't really understand how this scheme works with >>> get_user_pages_fast. >> >> With the RCU change it in #8 it should work just fine, because RCU >> synchronize has to wait either until all other CPUs have left the RCU read >> section, or re-enabled interrupts. > > So at this point in the series fast gup is broken, that does mean the > series presentation really needs to be reworked. The better > presentation is to add the API changes, with a > no-functional-difference implementation, push the new API in well > split patches to all the consumption sites, then change the API to > have the new semantics. > > RCU and refcount to free the page levels seems like a reasonable > approach, but I have to say I haven't thought it through fully - are > all the contexts that have the pte deref safe to do call_rcu? See Documentation/RCU/rcubarrier.rst: "Since call_rcu() never blocks, this code can safely be used from within IRQ context." So I think call_rcu() can be safely run in any context. Thinks, Qi > > Jason > >