Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2987830rdb; Fri, 22 Sep 2023 14:26:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGk8k/nD6KWZ74DJODQXI9HAwYucruV/AWq8cM2EMYP+qwRSkFk7o8xbjWgYDHXWPtBQgv9 X-Received: by 2002:a05:6a20:9742:b0:153:52a3:b0d4 with SMTP id hs2-20020a056a20974200b0015352a3b0d4mr686761pzc.34.1695418001296; Fri, 22 Sep 2023 14:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695418001; cv=none; d=google.com; s=arc-20160816; b=cRl9bzYt4lOTF+VyUfwaqycVDa1Vhu+3ot382YiOPZTdvB39Quq2eCuuahqiA7ntca gTTKK8s2UwdqU1e6jXZzrbtCyzluOljznLdYGK1seR5owa4WSMpX5qALSMwmlI0nshNb NtCIWdf1r4/GJJNGAvbT/NjQIM5mp20K5ll/z8r1oZ9Sg9w5dpLATMPG+L+LS/fngrWZ vEjuG0phiFR/dIICXE3V0PKnSStuUxmd9Z72RtPsi98RAC7HmvEDOK+/pI5e5IQ89uOZ 5FSJ5wi2F4hs/oQe8tkTpZ1BAjECedbuuJ0m0lw6mniJR/7kc7BCi5dDmN8S0feKMldE kVXQ== 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=0T607sMhgTfYruhqi8wwv+JLqEpq/mk4CQMx7i0zpfk=; fh=/yduxWaKfjuH91nvOTjgx7TmjoYR21pXx1+yQE+Lex4=; b=NaIGb1xRzVOTWzbeo90/t/heMFDUFYkaMzUivF06bzrePifOHTGctsjySvvJ1/+iV4 P/mvDkzZjJ3wOg4qXTsLfg2VlkqZkuCXytf9N80NRMOmJmZYYvoC0HzpVb4zrfk1K3Uw NjCVnhooXly9NYh9una2OXbCiLUZjLDalESOUP4epdMIBd17i2dCRKntUcHU/W43u1rD CXXG6K8lDCkLd79mmKEjPRaiH3mLu3sto6vcWRkEVP9mkS4DsWodLie9qtohY7Rnle0k 7vqS+IrNHgmha9wJ1ZV8SdiwypB0YUXCA7acAcP6RfRztTitGULB4YI9Ik5X6Fy3tygX lKlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ix7wVnHF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id e4-20020a17090a804400b0026b7c4eee42si6778267pjw.66.2023.09.22.14.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 14:26:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ix7wVnHF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 969AC83B3625; Fri, 22 Sep 2023 09:54:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbjIVQya (ORCPT + 99 others); Fri, 22 Sep 2023 12:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229533AbjIVQya (ORCPT ); Fri, 22 Sep 2023 12:54:30 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D8ECF1 for ; Fri, 22 Sep 2023 09:54:24 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-564af0ac494so1708283a12.0 for ; Fri, 22 Sep 2023 09:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695401663; x=1696006463; 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=0T607sMhgTfYruhqi8wwv+JLqEpq/mk4CQMx7i0zpfk=; b=Ix7wVnHF7+rysk8CvHxR2ql1bjHVV1EoQtTjthM0DJUlLWdB0OmSBZAEo9azvzNbOs 78uL+oBMK7lCEN5cWWOLqk/RtMqLhHGr5LUlAIQYVCplXZalHqL7BGCVmF9gTqUKsMCi hjoSPmg92ZHfNuAQsAc1xR0DKj5oHKpCP1oB039EJRE6oICLKVsVukp6xHtm9PCLpvZ8 er2Y2wKqPkoiN23ZnrUhF6r51Ph8ZIdGrdNZgdBh4ZIPLirwXeAPqDtCTpWSePMj50i9 awEavyzpd0W3zqJAw09ig9ZTYUJJqjOrYMQHZ+BbSRQkcjwR6ZeWPREBLq4IqO82JLMI ZZYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695401663; x=1696006463; 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=0T607sMhgTfYruhqi8wwv+JLqEpq/mk4CQMx7i0zpfk=; b=Ajtsy9aHw+5roAaGsRCMxm76K5BBJ44tTmMZ4/i36QeSHTGphaczqTIbfr3smvXYVP Mhrth03A463bvDJllHF71b909ApRPvZJ2SDfhsYH2PL05R83FK0o5fCuXQBXdR9UQbfy h1ua9a4l+lHU//w54Wv0Nhq7/wQb5ETYwOifxN7TlZNvgOONkd9NVS1hs3MMwWUBXM1L yT2xrgsoeNKo4rL/E78V+CT4yhf98gGY5XtuzZXAzmvbRazhA39G1i8++yXMiGTmu9aP UNqym+0TE4JQzUacNzKxjz9WGb0kdpNvrCTK15A87csj2vsx8JMU7pNCXEG4Y5ftQg6o gymg== X-Gm-Message-State: AOJu0YwBG6zzmhUqIALkkCZxG9J8OiRVtFONf8FT5BRxazNCp5Tagig3 2y/ipRfkj/bg4IynnNkgos6PhUhnTtUrRdycUhY= X-Received: by 2002:a17:90b:4b41:b0:26b:219f:3399 with SMTP id mi1-20020a17090b4b4100b0026b219f3399mr215435pjb.35.1695401663298; Fri, 22 Sep 2023 09:54:23 -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: <20230920054454.GA26860@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> From: Yang Shi Date: Fri, 22 Sep 2023 09:54:11 -0700 Message-ID: Subject: Re: [EXTERNAL] Re: [PATCH v3] mm/thp: fix "mm: thp: kill __transhuge_page_enabled()" To: Saurabh Singh Sengar , Andrew Morton Cc: "Zach O'Keefe" , 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=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 22 Sep 2023 09:54:41 -0700 (PDT) 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 wrote= : > > > > >> Especially, we do have bigger ->huge_fault changes coming up: > > > > >> > > > > >> https://lkml.kernel.org/r/20230818202335.2739663-1-willy@infrade= ad.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 pa= ge. > > > Filesystems can also use the ->fault method to return a PMD sized pag= e, > > > 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 n= o 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 D= AX, > > > > > and that's not true. It's just that the only drivers in-tree whi= ch > > > > > 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 descript= ion. > > > > > > I can change these paragraphs, > > > > > > "During the review of the above commits, it was determined that in-tr= ee > > > users weren't affected by the change; most notably, since the only re= levant > > > user (in terms of THP) of VM_MIXEDMAP or ->huge_fault is DAX, which i= s > > > explicitly approved early in approval logic. However, there is at le= ast > > > 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 consisten= t > > > 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 suc= h > > > 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 I think we tend to merge this patch, but anyway it is Andrew's call. Included Andrew in this loop. > > > > > - Saurabh