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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F472ECAAD3 for ; Thu, 1 Sep 2022 16:46:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6ACC980010; Thu, 1 Sep 2022 12:46:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65B8E8000D; Thu, 1 Sep 2022 12:46:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FDB680010; Thu, 1 Sep 2022 12:46:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 421AC8000D for ; Thu, 1 Sep 2022 12:46:18 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 15D941A0F1B for ; Thu, 1 Sep 2022 16:46:18 +0000 (UTC) X-FDA: 79864094436.30.E85C3C7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf27.hostedemail.com (Postfix) with ESMTP id B4FFA40091 for ; Thu, 1 Sep 2022 16:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662050777; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2b9v4HXJzhZu/yaMjJXJJEE+gK1pvbHfVCvX7BuxTMI=; b=a0fcn3JL4ZVjBngzn+TzjuqPwa7/M5c1+0cQ4CEGtk9CBBWzJ/L+j/aQ90KriEY4dDdSHO TMnIReuouZfkX+mCZcTn6RE4xswOlornB2Kd24o1UE2GD7eyIrd6gVd3OEbm4fZAyN4vL+ d2YHVUEnLb756GO5KtcyykIA6U9K5+w= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-73-LZ25HjYlOzeJUdM2VeJ5_Q-1; Thu, 01 Sep 2022 12:46:16 -0400 X-MC-Unique: LZ25HjYlOzeJUdM2VeJ5_Q-1 Received: by mail-wm1-f72.google.com with SMTP id r10-20020a1c440a000000b003a538a648a9so10083865wma.5 for ; Thu, 01 Sep 2022 09:46:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=2b9v4HXJzhZu/yaMjJXJJEE+gK1pvbHfVCvX7BuxTMI=; b=BoDSWmw1qjTjqkCpa+8fPGr7ttNMUI+h32WVP1PqelAphBUBmTh/nKa635XHnlBFbB YddICKzHuhe/J+CK+S8eYYhVyaQidYDnAfQp3Tuzm/4bvZ//+5R10F62KfwE0RtSIWSU RtrvPZM7Ofh/EOGwbMhOMtHvC+91xpEF7hOcLDhHZkpSHuKZDqG+hfAVf6A1ZaVOu7/u C+l2YPjefrlBTLLSw5UkaMbnEuxx3x3zqCGDoZDeATgWGCoG0DCsUZm+k6NoaFD/8zp5 IUtvARyo7f3cEOne3CZzth9P4h6kp1fK3RX9e347SQLuaOhkkZ/AUfGX/fzmCF9AeloJ 1org== X-Gm-Message-State: ACgBeo32Y0Qe594Y6An8g7Fpi3lcdtO0vczL3Rzz/9f8e8FTu12rMDNo GPpUurbxWv1Tq/9JAuVF4m2LcGXGaLd+AWZf9L0p5BkXMSXVbfB+22rr0G1UY9Jt295iB/cP9Ml uGKAz4zJOEyg= X-Received: by 2002:a7b:c4d5:0:b0:3a6:161b:4d77 with SMTP id g21-20020a7bc4d5000000b003a6161b4d77mr11049wmk.87.1662050774952; Thu, 01 Sep 2022 09:46:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR46f7lDfKgw7Jdfg/C67X2AVW4i1hdeIwsRk9vy73cEvdnFAp98R9rCbQQNyYOFDaDsj/3Aqg== X-Received: by 2002:a7b:c4d5:0:b0:3a6:161b:4d77 with SMTP id g21-20020a7bc4d5000000b003a6161b4d77mr11029wmk.87.1662050774652; Thu, 01 Sep 2022 09:46:14 -0700 (PDT) Received: from ?IPV6:2003:cb:c707:9e00:fec0:7e96:15cb:742? (p200300cbc7079e00fec07e9615cb0742.dip0.t-ipconnect.de. [2003:cb:c707:9e00:fec0:7e96:15cb:742]) by smtp.gmail.com with ESMTPSA id m15-20020a7bcb8f000000b003a83b066401sm5620862wmi.31.2022.09.01.09.46.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Sep 2022 09:46:14 -0700 (PDT) Message-ID: Date: Thu, 1 Sep 2022 18:46:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 To: Peter Xu Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Kirill A . Shutemov" , Sasha Levin , "Aneesh Kumar K . V" , Vlastimil Babka , Jerome Marchand , Andrea Arcangeli , Hugh Dickins , Jason Gunthorpe , John Hubbard , Yang Shi References: <20220901072119.37588-1-david@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v1] mm/gup: adjust stale comment for RCU GUP-fast In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662050777; a=rsa-sha256; cv=none; b=dVPaTtg2ww5t3rExsFAHzAntI5xv/fmRUFE/tBqaFNoK8CmceBI2O+BnwD8sZtZfOJiS2A IykVWzQ1nHGFUjrJ8fWoRGoCPdLiC6rqPHAydEeKxzaDG9ytbGICwcoXkptmmup1TIcFxq IO91q2Zy9+KFgDWimrokgZPf5VBzhWU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=a0fcn3JL; spf=pass (imf27.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662050777; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2b9v4HXJzhZu/yaMjJXJJEE+gK1pvbHfVCvX7BuxTMI=; b=RKnFpkaZlT2JZ1pM3TopvwL80nBYW8vea9QBdOmeEvciZ9QzBM2mNiNb3zriQn0OZklhXz 7TfQzDI7aChF2jCKm4OdxRl4o/q8BlOfThGfW6FqSv/699u63yDO0rolla+/e0fLjOnFM9 inKb9OB1JVdOpPLulMhG23rtTJglotM= X-Rspamd-Queue-Id: B4FFA40091 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=a0fcn3JL; spf=pass (imf27.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Stat-Signature: m47oob6hxhbtqaikup7opgdj4xc9t3cn X-HE-Tag: 1662050777-625098 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 01.09.22 18:40, Peter Xu wrote: > On Thu, Sep 01, 2022 at 06:34:41PM +0200, David Hildenbrand wrote: >> On 01.09.22 18:28, Peter Xu wrote: >>> On Thu, Sep 01, 2022 at 09:21:19AM +0200, David Hildenbrand wrote: >>>> commit 4b471e8898c3 ("mm, thp: remove infrastructure for handling splitting >>>> PMDs") didn't remove all details about the THP split requirements for >>>> RCU GUP-fast. >>>> >>>> IPI broeadcasts on THP split are no longer required. >>>> >>>> Cc: Kirill A. Shutemov >>>> Cc: Sasha Levin >>>> Cc: Aneesh Kumar K.V >>>> Cc: Vlastimil Babka >>>> Cc: Jerome Marchand >>>> Cc: Andrea Arcangeli >>>> Cc: Hugh Dickins >>>> Cc: Jason Gunthorpe >>>> Cc: John Hubbard >>>> Cc: Peter Xu >>>> Cc: Yang Shi >>>> Signed-off-by: David Hildenbrand >>>> --- >>>> mm/gup.c | 5 ++--- >>>> 1 file changed, 2 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/mm/gup.c b/mm/gup.c >>>> index 5abdaf487460..cfe71f422787 100644 >>>> --- a/mm/gup.c >>>> +++ b/mm/gup.c >>>> @@ -2309,9 +2309,8 @@ EXPORT_SYMBOL(get_user_pages_unlocked); >>>> * >>>> * Another way to achieve this is to batch up page table containing pages >>>> * belonging to more than one mm_user, then rcu_sched a callback to free those >>>> - * pages. Disabling interrupts will allow the fast_gup walker to both block >>>> - * the rcu_sched callback, and an IPI that we broadcast for splitting THPs >>>> - * (which is a relatively rare event). The code below adopts this strategy. >>>> + * pages. Disabling interrupts will allow the fast_gup walker to block the >>>> + * rcu_sched callback. >>> >>> This is the comment for fast-gup in general but not only for thp split. >> >> "an IPI that we broadcast for splitting THP" is about splitting THP. > > Ah OK. Shall we still keep some "IPI broadcast" information here if we're > modifying it? Otherwise it gives a feeling that none needs the IPIs. I guess that's the end goal -- and we forgot about the PMD collapse case. Are we aware of any other case that needs an IPI? I'd rather avoid documenting something that's no longer true. > > It can be dropped later if you want to rework the thp collapse side and > finally remove IPI dependency on fast-gup, but so far it seems to me it's > still needed. Or just drop this patch until that rework happens? The doc as is is obviously stale, why drop this patch? We should see a fix for the THP collapse issue very soon I guess. Most probably this patch will go upstream after that fix. > >> >>> >>> I can understand that we don't need IPI for thp split, but isn't the IPIs >>> still needed for thp collapse (aka pmdp_collapse_flush)? >> >> That was, unfortunately, never documented -- and as discussed in the >> other thread, arm64 doesn't do that IPI before collapse and might need >> fixing. We'll most probably end up getting rid of that >> (undocumented/forgotten) IPI requirement and fix it in GUP-fast by >> re-rechecking if the PMD changed. > > Yeah from an initial thought that looks valid to me. It'll also allow > pmdp_collapse_flush() to be dropped too, am I right? I think the magic about pmdp_collapse_flush() is not only the IPIs, but that we don't perform an ordinary PMD flush but we logically flush "all PTEs in that range". Apparently, that's a difference on some architectures. -- Thanks, David / dhildenb