Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1531343rdb; Wed, 20 Sep 2023 11:42:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUWLIoA4XSIGKZyI8NV6hdpWwGEYq1LnMebca0RYgwL4pr29Ej67/s9Ii5SdcEXnqr+yTP X-Received: by 2002:a17:902:d3c5:b0:1c1:e4f8:a5a9 with SMTP id w5-20020a170902d3c500b001c1e4f8a5a9mr3135462plb.34.1695235326277; Wed, 20 Sep 2023 11:42:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695235326; cv=none; d=google.com; s=arc-20160816; b=PLfYrvqEXAGpphPzLd0rHFYzpSG2Wpof/pkhc7itqhL7D0ut2pRNGfPLUm+/7wCKAM r4LYmTSo4zucq3GslRJpZnVgxIs77tfLutcQEokJoUzoPreZgoJ8gtGF7WmEUtr3dGcN IaYllh0cMqa2ODuCV3yituDoLD+Q0V10HRBJaSJ6nscMQMgJXAkLrE6djRZxKCBzdjmp c9fIn0Qph7nGoR6Gp1V140I0UorA/rzmmb1exrg4a0F4swN+aii2/USUqXzm3z8fSokv RV2DaiKezOi3u/cmsxpUQRn25LPmOP+hkS/JZLYdFvhKFDGhAa3JIhimWpkdbRp83wn2 KjZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-filter; bh=8sN6z5YjhtFz0yFNj635BK3PS4McjJIaFDZfvIlqfVc=; fh=3JfQOBDrvSFwFF4UPCMA9H0KBNuodV6Dymgc97BLxfI=; b=h87Y9t768GFESS8HUXBS2sYP8ojUd03SLrt5zcqRCEj1mPYDRijKbnSKukwzxLdg1C astE+IXxw080/LYXREx8+i0NZFRHHRR4uzn4Lt1KsycYT/hm2TDmmHRZ4q/MVxj8Qhiu t9+uvxnTXuBhdVNXKF+WsANb1AbjqNEQ6PFVJn+bKnuGjuA13bMU0jtGIQjYPeS803AF bBCM/SaZ4xTv/YZErcvE3jTalzc7Jq+jPMaEv9wy1ZeBJn4UK7wv1grD/0MstMJ3ap0s r/kYmbPwICTNxrXbdjrM4RSIL5Ljul320T0srbBeyc+YucltKhpZuwzL8aDDNiKoustu 8Reg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=dtToQtEu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id s1-20020a170902ea0100b001c563252d68si6818932plg.579.2023.09.20.11.42.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 11:42:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=dtToQtEu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3398B8206D69; Tue, 19 Sep 2023 22:45:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbjITFpE (ORCPT + 99 others); Wed, 20 Sep 2023 01:45:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231839AbjITFpC (ORCPT ); Wed, 20 Sep 2023 01:45:02 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E313D8F for ; Tue, 19 Sep 2023 22:44:55 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1127) id F0D91212C4AD; Tue, 19 Sep 2023 22:44:54 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F0D91212C4AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1695188694; bh=8sN6z5YjhtFz0yFNj635BK3PS4McjJIaFDZfvIlqfVc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dtToQtEuwQZb7hcE7TLvwY/My32GHeJ1ZpuVKZd56M5ZFH7HgSj9Czng7E7u2XMKa Q9yLQXt/7xIxy+wWEWcJ/cd9xLSWgYNy2SgNx2EpX4llBySS6khuFt3+W7zTu/rAr6 6biQCqzz5XgLwyr0gj7cskhmgjPq4QBVEhoZ61qY= Date: Tue, 19 Sep 2023 22:44:54 -0700 From: Saurabh Singh Sengar To: Zach O'Keefe Cc: David Hildenbrand , Matthew Wilcox , Saurabh Singh Sengar , "linux-mm@kvack.org" , Yang Shi , "linux-kernel@vger.kernel.org" , Greg KH Subject: Re: [EXTERNAL] Re: [PATCH v3] mm/thp: fix "mm: thp: kill __transhuge_page_enabled()" Message-ID: <20230920054454.GA26860@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230906065817.GA27879@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-17.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,SPF_HELO_PASS,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 (snail.vger.email [0.0.0.0]); Tue, 19 Sep 2023 22:45:02 -0700 (PDT) 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 AM David Hildenbrand wrote: > > > > > > On 25.08.23 14:49, Matthew Wilcox wrote: > > > > On Fri, Aug 25, 2023 at 09:59:23AM +0200, David Hildenbrand wrote: > > > >> Especially, we do have bigger ->huge_fault changes coming up: > > > >> > > > >> https://lkml.kernel.org/r/20230818202335.2739663-1-willy@infradead.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 page, > > 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-tree > > 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 order to keep an > > > >> OOT driver working -- possibly for a short time. I'm tempted to 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 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. > > > > 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 broken. > > > > Remove the VM_NO_KHUGEPAGED check when not in collapse path and give > > any ->huge_fault handler a chance to handle the fault. Note that we > > don't validate the file mode or mapping alignment, which is consistent > > 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 such > > 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, but > > 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 > > - Saurabh