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 1D493E95A96 for ; Mon, 9 Oct 2023 13:22:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E4CD6B0180; Mon, 9 Oct 2023 09:22:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3957C6B0181; Mon, 9 Oct 2023 09:22:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 240176B0182; Mon, 9 Oct 2023 09:22:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 114066B0180 for ; Mon, 9 Oct 2023 09:22:54 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C63B0A0239 for ; Mon, 9 Oct 2023 13:22:53 +0000 (UTC) X-FDA: 81325988226.22.3353B11 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by imf15.hostedemail.com (Postfix) with ESMTP id EA416A0033 for ; Mon, 9 Oct 2023 13:22:51 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=PT8z83xu; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf15.hostedemail.com: domain of zokeefe@google.com designates 209.85.208.48 as permitted sender) smtp.mailfrom=zokeefe@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696857772; 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=8ucMi41TQkv++KBAnHCuW8sOa9RykSneNLP1uSJ3/rY=; b=C/FEr0tk+g0UTvAPnzWxpxk95UsFYn1NFlRfH9CjwfJA7ektDqkbANXIg1uTp2XqzLUnxG ufkMlWslsWnsPWkC22Ac6zOnHcfMSP2EvUDE76QBhTa9mDa8H9ZghOINyAcbOPEiZ1LPJW UPV82TloliFam6db7Ue10b0CJSk7nxM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=PT8z83xu; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf15.hostedemail.com: domain of zokeefe@google.com designates 209.85.208.48 as permitted sender) smtp.mailfrom=zokeefe@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696857772; a=rsa-sha256; cv=none; b=PEAourCyRKDBS2McFXTh1HDH/DHXgaE2rX8fjPkA0mV4G1I/pbs+V1FUIm7IZCIQ0ueZsK MY24F6FaZO6u0Ac2BC/UyHh+lrUc9q+m6DCl8wPRDZIVbS1fTFe35Fli3JZAmA/wZKcNzI dC0PPRWETvWK0CVU/nY6MyIR5b6D+rU= Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-51e24210395so15910a12.0 for ; Mon, 09 Oct 2023 06:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696857770; x=1697462570; darn=kvack.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=PT8z83xuDdX8XwYKNvAhEcJ6UM6e8D65/tD0RSwqG4ejpi+eGws4h3Hr4f6ujjjjSC UIghnY3UENdZBLItu8BodDEqTbtSxS7vNgJV8J4UQg5r0IDue6Ue2cym8eKNGbodETqO 7lejl8WWmP7kOPuWigMAGS87MB/fQX49Z1ZnP2cUsKNO/Xvw5pPL7oEbX/Ksvt0IXeTv rmR2NqALP1GYmhw1E+Ya4tfDJFkxPHWldUsV3x2a/SZayziPOAzSkuobu/Ib0L9gNgia qn120ub6Ayy73LCizNElYdV4igAJVeok0JbItFCLHVHrwbQ08WEo8/vkrROP+Fpgt2xY bQmQ== 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=N5e1uwtoS3lCmaatb53PfUmVRCLD3y7iRmI+2gPaTDSkuTNaVvBslUIXHsgT6Z6f2/ 098Z/ITv8J+R7kJRnHibFhoDdcPnexw8rdKJCpqIhBnqhKxwYWL2gFfj4Jn759ZHjcG4 4ExU1XJSmdqlJk0EFhpJNqDdKzlgBbdsU+PBMJUbALCvN945dtpWCR6gd6UxEO7WwvBO wRzsoMfblFfRPtVfPeOP6Kt0FaONVAYi7JQLjnQggBkWsYRL5PjCQl0RWzKCYwYOoXuT p4ocP3D3COC0xaZ4dqZIUJ+w19MVfrWCbVhtVFvwQoOsxdLWC5RBNywkUQ7Ei8BDtl3N WSOw== X-Gm-Message-State: AOJu0YyVB4FJvz6bOfhOL+NFVpAJiISrZu2I2e7RBjuGheypZ0fv7NZi Hvc4REx4fmXSuEMVUk1F1OpqX6jvwRZpffmNcSnOGA== X-Google-Smtp-Source: AGHT+IFOUr34G+Yla/d4AVAiHklOzTMuqIvsyl6uOGRaCES8wUndJpjxEHBlFLQrrKJSoyqaqmBfRSqGnVKYP8wY0oM= 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-Rspamd-Queue-Id: EA416A0033 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: tk58y3tjbonyfo748nbr8zgqgotwkooo X-HE-Tag: 1696857771-340675 X-HE-Meta: U2FsdGVkX1/qi2ruQffkKbPe7nFYDeD1/BqBe2TAtUnzOsBm1nivBBjOSQIVIWssOf23GWW0dBSpLjz2AQ2aomjuvQ+MNalN77wtBr2zdJnjtX+vUviSZJqQjaa04RxMVrP6/uk4lrUE23daautY7RaBtqJ3Ek9iEjDPiaVI+xJbPPxLY+G8BAg7nzY64w3rqmJMnOEq+O5K8TPM3bNE5ORx53jhL/kQIMqN6IcCrmrvN7vAJyo5iRtDNurPQmCEwbgdu5jHsOrf4rUvUzFUpc/EweHIFCBHXHBUktU92TrQU0KHWtA+GRWZkjm4jS+gdeCSHOBTH6KV2cfYE02hEA828eUNfLI68k2u+CxeB+l9KNVeviFiFvjDVyMQEZbKuSN+ICspDryCM6C6A5KiygyeSlSNojZ1DG53GvMCoWPLdUsvgGvFnwP6THnS5slorhoIAADDQJH5VVJ3qofbXOVaORzU9HKvH4nDsT+rKy/+lET7o/vB590kWQ4zLJv/bIp6A5qGLrE3ROcTPCoYZGwkA7WVDtKMnQwRmDnY8gB0InQTWntWuIsSE6Vx2s+j0c2+/KP7ZqqtBKfH1lTxKBB42rzhOOnXaRZAW6/GztF3CWGitbR624OrBN2fpkvu4VSePTvg4aJ9DCqh3hT3wCiK5D+NMlZZBrcHJlw+a0iJIS1JXK6AzzWC60t2vBTS3ZRHGOCLKutG30PJurltGYge9dxwpDr8zVrhE5flkAagWRS2qO+8RgSw4dihgusQSnxq9fplRmWo4PbaqysZuyA2mNMt1l48OQxDDRY3CHrxJa8LNTh5vnmO23+IkYyfQf1Q+U8cpPEaZhrOkHE4r7xckz+Rl0yv9XuIKeP34PyhPiJmyfbTggyO+ct6vUd6t9hWjE3BS1Ig+DJMWeKQhweAecGFnbuVcHJCCF+5oF8xrdUkEnhjn56SLamlhnDbv3ksi6VzPZ0TT5ijAJK mdd46i4C 7ja+OjTbbLtBjcaCaEv1HF+h/qX2r9esu6aVIIetufjqtVlDCEL9fDY6TOvOWuK919II7zDwm2mbTAbMpk3oK2AWBvI6QhPr+2R0+EN4sjB5hHjq+uYltxvELDc2HP3rbuJK7WMSAzxr/EKBqXHeDpWhH7MUFl53T5xXLRLOWo7GN/zV+INAucbMW1/d8u/mgWJROeqqnSPnvdSQuP0AacuS56D3vDM93Y8CarFJQgRwtOsa1DEJu7W6uJ5Eu/6P+rssvX/tdq2NZ0JnpfbVMndudUN2ujOByiSI4OPCPUdDevrruezEGRfupq/GidceyePySI1MkZKOEUv1uAoJ67xbXBfRDEShzjFBcXYp1J06WUwQb/v3ZMxU5l1MMfQa/13qW1WlSCAK5tanlikPntoGzjwFfuKeeTKfbXuauZgMf2B44FMB8lfMutpu94yYVHx4UGjU18MW9IwV6Jsi1Qa0GeTVVSsrrm4S7 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 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 >