Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2905293rdb; Fri, 22 Sep 2023 11:33:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEY5+2bcXlA/+1BwiJULWpG0w/CeqbzVZFv5bJvXXZUncb0UtvUis3ow/dCWkFDZBXRiIIq X-Received: by 2002:a05:6a20:1587:b0:15d:1646:285a with SMTP id h7-20020a056a20158700b0015d1646285amr534251pzj.21.1695407580809; Fri, 22 Sep 2023 11:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695407580; cv=none; d=google.com; s=arc-20160816; b=D9b12aFwnvpFvojQF9HL4RyUl4tRuYIJ0JIhDdjsCHmbuOoGp0+AnJZP6usBuY+rKU 5Z1bbw6gwFv0boIF1a3+UH1P3SeyeufWT41GJxsRxqFMPgxrl3n9jJzf+U85N0cOSmEf 6K/AHzSrzr+v2sMya2pBNp2IOH0S9U0wj8lJ0cXs3SsavNWSB4GoH00fhtKWPPPYZm+O uo1wq05a2g4RBQ7A/I7MRgovsO7BhSgYup9wh2ofvAaft7+FFScIlw7iL4KfEY6SnXug xBfSg1DQsoeK8DEJh8qPk8o1Z8Ctt9t+gdHJe6xepL5pe+wFE0tg2zSqfhAw5gXTnnuY F8hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7acKa9vg/VWzTL8BaOiKje9AL2xB6Xnf1TelKGJcqls=; fh=jljQOd9BceT+hVKkPJwvoa7sFckr9L+NdgynPrGh4fA=; b=duFExLLp/NpupF4+DyMFayaqvAcxS0bIUBwj2JFOWeiWSkc7g1vro7tCM0FH2Pew3j hBpF/kH65fcGnw0DrBFSbGRe0xYLsqLJlNya1NUM6WQLvNh5B/YD81Qj74n0rYypkcJR ow0LIidxeg1zhqZFZOG7TYboXK9lgt90yA2xZiv4mJC+nf8fRpVm19hLhxRk/PYYHabX yXOy8q83/YvkYxDlYRu2js+npzoBCGysD7gj9HkHSwjHY6Q6ICOC3QE406KlOtNzhF5J UWJfxo5/d0lgoL+wYdaLsyjLpdCGSyGy1YsODT/oXVneJqusdAwQI7997LietJCHIrQh 1vQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="LOx/WZE5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id h28-20020a63f91c000000b005697ebac19esi4089982pgi.776.2023.09.22.11.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 11:33:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="LOx/WZE5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 66E24875FDAA; Fri, 22 Sep 2023 09:57:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbjIVQ5K (ORCPT + 99 others); Fri, 22 Sep 2023 12:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjIVQ5J (ORCPT ); Fri, 22 Sep 2023 12:57:09 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B770CA1 for ; Fri, 22 Sep 2023 09:57:00 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-53368df6093so267a12.1 for ; Fri, 22 Sep 2023 09:57:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695401819; x=1696006619; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7acKa9vg/VWzTL8BaOiKje9AL2xB6Xnf1TelKGJcqls=; b=LOx/WZE5tIM7SsXBGc7TlDBE597kS7JoIG4OFBEmJm2rGP5z8HG3w46+KGRPJ4ZueE pYd0ajnO/7OugU+bmd/i0UU/vpaaoqQc5XBWVfciwgeouaHecuxsQKMIH/Zr//5y+5G0 rUaIL75WGVEKIY9Q7wZxxT0Z4VVwZxtFxygI+GBZJqnmQKDcEB5FnLTMlgeFMxqGjlT2 i4oUM67Lh8UM7ozKqC9AyeYBlyEBK5kyZx5q36Fc/3MqSgA9hGTwYjcH6mkJJkqLppdX 2jnofRruYOtBH1ZEgwkJlC8AAcmBl8qtihwfUTmiSkAS7yViBMJZUYNfImNfaHAoYDG7 uAcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695401819; x=1696006619; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7acKa9vg/VWzTL8BaOiKje9AL2xB6Xnf1TelKGJcqls=; b=Re5W3f9wztYr7XyqXo4PaCcVx+ti3wnxZBuuAcgPXbCCgroSh7cS6f6p8BlKR5RtPs 5NZxSLeJaSk7MwT18VrI7yIHuV3OsT97cxEAcW76l43Ctb8g5meeAYvCRloEaLLmj/lu rHw35r/97HcIBVKCOaD6+mufUhZCPnVjDbguChHXLPTsD8+tZh0zk/hbLNC5HFjKg9h+ GSYrt/CRBvAORnjh/Lb4/2VeKHSuFI+SnpoJAT3fikQdGAOr0H0M8aoel4Wa5IQezWr2 oE63vZbeczeh4x5MbQzWTjuEduxW5+u9u5Ytw7cYLpZ8/oQ3iZ3m8H66b3agEVs4knza M68A== X-Gm-Message-State: AOJu0YwAFMIgxK37WTvGQEdUc10v+MuB/aBU4soNuuwz6yCprmjIvzY4 G+4h43dLtGtU2Diindm9+uJrlbA23u6gr5cfsyMohg== X-Received: by 2002:a50:a41d:0:b0:525:573c:6444 with SMTP id u29-20020a50a41d000000b00525573c6444mr3940edb.1.1695401818931; Fri, 22 Sep 2023 09:56:58 -0700 (PDT) MIME-Version: 1.0 References: <37c2b525-5c2c-d400-552c-9ccb91f4d7bf@redhat.com> <3e08d48b-7b70-cc7f-0ec1-12ad9b1a33db@redhat.com> <3408ff54-f353-0334-0d66-c808389d2f01@redhat.com> <9f967665-2cbd-f80b-404e-ac741eab1ced@redhat.com> <20230906065817.GA27879@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20230920054454.GA26860@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> In-Reply-To: From: "Zach O'Keefe" Date: Fri, 22 Sep 2023 09:56:21 -0700 Message-ID: Subject: Re: [EXTERNAL] Re: [PATCH v3] mm/thp: fix "mm: thp: kill __transhuge_page_enabled()" To: Yang Shi Cc: Saurabh Singh Sengar , Andrew Morton , David Hildenbrand , Matthew Wilcox , Saurabh Singh Sengar , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Greg KH Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 22 Sep 2023 09:57:08 -0700 (PDT) On Fri, Sep 22, 2023 at 9:54=E2=80=AFAM Yang Shi wrot= e: > > On Tue, Sep 19, 2023 at 10:44=E2=80=AFPM Saurabh Singh Sengar > wrote: > > > > On Tue, Sep 05, 2023 at 11:58:17PM -0700, Saurabh Singh Sengar wrote: > > > On Fri, Aug 25, 2023 at 08:09:07AM -0700, Zach O'Keefe wrote: > > > > On Fri, Aug 25, 2023 at 5:58=E2=80=AFAM David Hildenbrand wrote: > > > > > > > > > > On 25.08.23 14:49, Matthew Wilcox wrote: > > > > > > On Fri, Aug 25, 2023 at 09:59:23AM +0200, David Hildenbrand wro= te: > > > > > >> Especially, we do have bigger ->huge_fault changes coming up: > > > > > >> > > > > > >> https://lkml.kernel.org/r/20230818202335.2739663-1-willy@infra= dead.org > > > > > > > > FWIW, one of those patches updates the docs to read, > > > > > > > > "->huge_fault() is called when there is no PUD or PMD entry present= . This > > > > gives the filesystem the opportunity to install a PUD or PMD sized = page. > > > > Filesystems can also use the ->fault method to return a PMD sized p= age, > > > > so implementing this function may not be necessary. In particular, > > > > filesystems should not call filemap_fault() from ->huge_fault(). [.= .]" > > > > > > > > Which won't work (in the general case) without this patch (well, at > > > > least the ->huge_fault() check part). > > > > > > > > So, if we're advertising this is the way it works, maybe that gives= a > > > > stronger argument for addressing it sooner vs when the first in-tre= e > > > > user depends on it? > > > > > > > > > >> If the driver is not in the tree, people don't care. > > > > > >> > > > > > >> You really should try upstreaming that driver. > > > > > >> > > > > > >> > > > > > >> So this patch here adds complexity (which I don't like) in ord= er to keep an > > > > > >> OOT driver working -- possibly for a short time. I'm tempted t= o say "please > > > > > >> fix your driver to not use huge faults in that scenario, it is= no longer > > > > > >> supported". > > > > > >> > > > > > >> But I'm just about to vanish for 1.5 week into vacation :) > > > > > >> > > > > > >> @Willy, what are your thoughts? > > > > > > > > > > > > Fundamentally there was a bad assumption with the original patc= h -- > > > > > > it assumed that the only reason to support ->huge_fault was for= DAX, > > > > > > and that's not true. It's just that the only drivers in-tree w= hich > > > > > > support ->huge_fault do so in order to support DAX. > > > > > > > > > > Okay, and we are willing to continue supporting that then and it'= s > > > > > nothing we want to stop OOT drivers from doing. > > > > > > > > > > Fine with me; we should probably reflect that in the patch descri= ption. > > > > > > > > I can change these paragraphs, > > > > > > > > "During the review of the above commits, it was determined that in-= tree > > > > users weren't affected by the change; most notably, since the only = relevant > > > > user (in terms of THP) of VM_MIXEDMAP or ->huge_fault is DAX, which= is > > > > explicitly approved early in approval logic. However, there is at = least > > > > one occurrence where an out-of-tree driver that used > > > > VM_HUGEPAGE|VM_MIXEDMAP with a vm_ops->huge_fault handler, was brok= en. > > > > > > > > Remove the VM_NO_KHUGEPAGED check when not in collapse path and giv= e > > > > any ->huge_fault handler a chance to handle the fault. Note that w= e > > > > don't validate the file mode or mapping alignment, which is consist= ent > > > > with the behavior before the aforementioned commits." > > > > > > > > To read, > > > > > > > > "The above commits, however, overfit the existing in-tree use cases= , > > > > and assume that > > > > the only reason to support ->huge_fault was for DAX (which is > > > > explicitly approved early in the approval logic). > > > > This is a bad assumption to make and unnecessarily prevents general > > > > support of ->huge_fault by filesystems. Allow returning "true" if s= uch > > > > a handler exists, giving the fault path an opportunity to exercise = it. > > > > > > > > Similarly, the rationale for including the VM_NO_KHUGEPAGED check > > > > along the fault path was that it didn't alter any in-tree users, bu= t > > > > was likewise similarly unnecessarily restrictive (and reads odd). > > > > Remove the check from the fault path." > > > > > > > > > > > > > Any chance this can make it to 6.6 kernel ? > > > > ping > > I think we tend to merge this patch, but anyway it is Andrew's call. > Included Andrew in this loop. Sorry for delay -- just back from (another) OOO, From this back/forth with David/Matthew, seems like we're OK saying, "this was a mistake", and that we can take the patch (need some form of Ack or Reviewed-by from them first, to confirm) > > Fundamentally there was a bad assumption with the original patch -- > > it assumed that the only reason to support ->huge_fault was for DAX, > > and that's not true. It's just that the only drivers in-tree which > > support ->huge_fault do so in order to support DAX. > > Okay, and we are willing to continue supporting that then and it's > nothing we want to stop OOT drivers from doing. > > Fine with me; we should probably reflect that in the patch description. But, I don't know about timing. We are in 6.6-rc2, and this hasn't been exposed in Andrew's trees yet. 6.6 is looking like it could be a LTS candidate, in which case this patch could flow backwards from -stable (which would also land in 6.1-y) .. but I don't know if that path is suitable for this. Otherwise, perhaps you could include this fix when you're ready to upstream your driver? > > > > > > > > - Saurabh