Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1891824rdb; Mon, 9 Oct 2023 06:23:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBwxwjA/5e7SU8QmNecT637U/EvY/pZeSozDdgq20g+QkYMB2PbeRpyU09jLYS16XX/gAg X-Received: by 2002:aca:1c18:0:b0:3ae:5c89:dcc2 with SMTP id c24-20020aca1c18000000b003ae5c89dcc2mr16955532oic.34.1696857784177; Mon, 09 Oct 2023 06:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696857784; cv=none; d=google.com; s=arc-20160816; b=dJyW1rSfo0CfxzM8VVPyJ7teN0ScYg8mqjrfQ44Ng4zlb6URMuvb0PZRxL7QP+ONiB 3bMkY4zXojXZsok412jOgVIAUKsauEXeNorr7uoNv3xqQoU0T4SaNjucQfaZPUufr07J sxGBNhbDQP4QqEkKBVuIfYx5+nvudp2KEnyBQlzw/nz2146S66MM8SJ8kzVsue9of5Eb M1Vo1Hi1z+D+KWGYcG3LkW6QMDmImZZMzIu5zp3Yk3wBoOw+zntQfYOOd2LLylO6xM3j ++zwO8jtVtLxHFPtx5Vk2mqu3aTRWinlcLqa1wCPRsmkI0NcyJjssSoY8LU8X4BMvFdE 1xtA== 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=8ucMi41TQkv++KBAnHCuW8sOa9RykSneNLP1uSJ3/rY=; fh=2p0CCxmd0v8gpZzhtAH/NIcIcxKOGIwRaSef9JNZ6ks=; b=x2TA1KEnaYC+scnD54U8HgNGPoX8JeTrpFWTvHpILqL9AUqoS6oUy0zJeMtdfzAg2N 0hNaNqQrvpZWxNOKnTrudASxG5WYqY2FIgXLBs78DHxnkSpicXD1NXJmPJoFBdKVw9Ay mZgMHB2qyPgb21H00av8CtMlWpP2XvCzNbXJI9e0L/TBxylyhZmZOOxb55ELVt/7Rd6W 4LRcMVzEe65qJj0Pko4/GhCCKxhYNFz2VMzpo1TOIe3c8qh9D7GIuoUXqslQ14Vx951K Q964ZZeORTM4QQ2QEtrXD5gEnv29o+qkqoLJkWNF0lWQkVMoscRbpPNQF1zRpSiSD5au CGFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=4M3epxgk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id c5-20020a6566c5000000b005859e224617si9931996pgw.818.2023.10.09.06.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 06:23:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=4M3epxgk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 15E7380320EB; Mon, 9 Oct 2023 06:23:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376426AbjJINWy (ORCPT + 99 others); Mon, 9 Oct 2023 09:22:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376396AbjJINWx (ORCPT ); Mon, 9 Oct 2023 09:22:53 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C2228F for ; Mon, 9 Oct 2023 06:22:52 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-534694a9f26so13049a12.1 for ; Mon, 09 Oct 2023 06:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696857770; x=1697462570; 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=8ucMi41TQkv++KBAnHCuW8sOa9RykSneNLP1uSJ3/rY=; b=4M3epxgkhirh85jt5J2jq1bEB8pXmohefDRjKIBkTZ0+ADikHycH2uYGACgkxdFgg6 9vLZCpWMdx3aAeu2wCk8CDNkCFNrdDfjBD51CSVjtT8uDo1aUrTeu+Au0ZNV75NfdSAL rMEOHII2SvIaDoLQXKpBiuJiWY5+CLFRP6FmCac1QE49vz+RN7s/NOaTDAzsljmxYxxd ReMcnsQXjEqviPU0hQgLEtGcVc7vnwxJg73VSOIbd+jwafpYv1qfGjpdnGSBx6lU+cfK FDHPU6t4g8Sxe2RRbH6thXnHdd7iVaYEHz8gxyqu5OJqzaSGNAWvssTnBSbYGeEUfYD1 j3Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696857770; x=1697462570; 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=8ucMi41TQkv++KBAnHCuW8sOa9RykSneNLP1uSJ3/rY=; b=P+Ec/FMYcSQpiXzho+T16FfZsuK1jae8KW9SsYVLFtqtokMWKT38IMev7jjOe6aTSi kUnbzasutkV3h1nu5g2zZShBwzvJZTdMm48CI/iAdgQGvInCfgmwyc4mC7ZH7ISaVkSu u6p5/AQCUSUeYAZmDRiY5lkRZIw74IrNIVhQhFZelxyjvE6XwZoYNQAsEA+bMf9VLDmB dQ3ApsytfKORN010ZR9hPLhAClsBoC+sRCqCo+jFFTBxiXWF7b+AymiUQiTh5EfwgLH/ noV0FvwEr3EHpfYwyQsonqTBNuBeQoQKhqoB/pMYnWdN9h8GGJazAKsy5JlwdKCaWyo/ 2BSw== X-Gm-Message-State: AOJu0YyalAH8cdswVpJkGXHksotpoU+9rXk0jAz048YiTOQxvmoKKYSR 3QK9puC9NE4cZdwbPNTFHbAJuH+NzGIWuWap0QfK14883IZT5seHfu0= X-Received: by 2002:a05:6402:d4b:b0:53a:ff83:6123 with SMTP id ec11-20020a0564020d4b00b0053aff836123mr227837edb.3.1696857770226; Mon, 09 Oct 2023 06:22:50 -0700 (PDT) MIME-Version: 1.0 References: <20230925200110.1979606-1-zokeefe@google.com> <20231006105012.61a12beefaa0f9a5adc8299f@linux-foundation.org> In-Reply-To: <20231006105012.61a12beefaa0f9a5adc8299f@linux-foundation.org> From: "Zach O'Keefe" Date: Mon, 9 Oct 2023 06:22:14 -0700 Message-ID: Subject: Re: [PATCH v4] mm/thp: fix "mm: thp: kill __transhuge_page_enabled()" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Saurabh Singh Sengar , Yang Shi , Matthew Wilcox , David Hildenbrand , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 06:23:01 -0700 (PDT) On Fri, Oct 6, 2023 at 10:50=E2=80=AFAM Andrew Morton wrote: > > On Mon, 25 Sep 2023 13:01:10 -0700 "Zach O'Keefe" wr= ote: > > > The 6.0 commits: > > > > commit 9fec51689ff6 ("mm: thp: kill transparent_hugepage_active()") > > commit 7da4e2cb8b1f ("mm: thp: kill __transhuge_page_enabled()") > > > > merged "can we have THPs in this VMA?" logic that was previously done > > separately by fault-path, khugepaged, and smaps "THPeligible" checks. > > > > During the process, the semantics of the fault path check changed in tw= o > > ways: > > > > 1) A VM_NO_KHUGEPAGED check was introduced (also added to smaps path). > > 2) We no longer checked if non-anonymous memory had a vm_ops->huge_faul= t > > handler that could satisfy the fault. Previously, this check had be= en > > done in create_huge_pud() and create_huge_pmd() routines, but after > > the changes, we never reach those routines. > > > > 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 rele= vant > > user (in terms of THP) of VM_MIXEDMAP or ->huge_fault is DAX, which is > > explicitly approved early in approval logic. However, this was a bad > > assumption to make as it assumes the only reason to support ->huge_faul= t > > was for DAX (which is not true in general). > > > > 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. > > It's unclear what are the userspace visible impacts of this change. > Which makes it hard for others to determine whether -stable kernels > should be patched. IMO, I don't think this change is suitable for -stable; the only users that would have been affected are those that maintain out-of-tree drivers / code that hooked into ->huge_fault() or used VM_MIXEDMAP + THP. No users of the in-tree kernel would have been affected. It's still a good "fix" to make going forward (and certainly happy to be able to help Saurabh out). + greg k-h for vis / to confirm. > > Fixes: 7da4e2cb8b1f ("mm: thp: kill __transhuge_page_enabled()") > > Reported-by: Saurabh Singh Sengar > > It's nice to include a Closes: link after a Reported-by:. Then readers > are better able to answer the above question. Ah, apologies, Andrew; I didn't know such a tag existed -- I'll be sure to include it in the future. > > Signed-off-by: Zach O'Keefe > > Cc: Yang Shi > > Cc: Matthew Wilcox > > Cc: David Hildenbrand >