Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1154667pxu; Fri, 27 Nov 2020 00:39:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8pcwV+WMduo5LdHNF5buiLPudPLBmChaV2QeSZUl/h4mb1+Zaw2Ch4oIfM3eABYsEZjgJ X-Received: by 2002:a17:906:268c:: with SMTP id t12mr6231086ejc.377.1606466345667; Fri, 27 Nov 2020 00:39:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606466345; cv=none; d=google.com; s=arc-20160816; b=FGkU/CgWXbXP+wwFlMXyy6VjxYkYpOYdszUtIeCdoT+WN9LSBYAeJB5bbYPGpM3bNN 7wdUVFhZZcHKJv8ENNvJ32izVZ0o8Fj0nXPFDsWuTat25ivAonVV0UlzPOEo0qwNv/27 rHdLWUjq++ftxBMIenEqI1IueUp6G5lZmk0Mb/jv3Pscdcph7Y+vMu1w/IOH9oWvmfIt QcJ/nrFAZBwMJbRbuNbc12cNYrMm3TtM3D1SMo8XJRaXF5ux1ls10tnUckOLpHpZJtfl FWNflX+7LTNVt3ZUV12nCspljj04VOdYtI2XToqUPyGolutjTNqNzsECNPHkz6+Dt6wi 33xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=OchD8037VlKQ+TjuftQFa5xcjDkAffV+ztFgs4d6tJA=; b=rsW4e9Fn0kMZjK0L0JJfPwLCGl4ZRKT8Tl/FXGt1WcRppAfu1tBcJLJ1tSip1qDH3a EP2Q9vN9KflvxbtRXZ/ZhKeDe4ElflfQiaqkCQ/INuEzZGhY+VnfP0TsNlnuPjaNGkKg yA0JSMSCCj6jF96Om6cQvuI7KXHuw/beHOl+GQ3sj5hkuzPRUW3eQhA9it5Oqrphnt7K MjzZ5gyRvuGEiQx58gCdTXvfwzrwGVYOI3UNg0tLKQYCoH78Y1m1cYmXngjD9wykGGfh Z7aAh0/XGtWp8t1OySLgIi9hF6biIbU4TSttRz8J2IyRdwBzAkS+UsAs5H21zM+mUFDx vERA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs5si4717079edb.176.2020.11.27.00.38.43; Fri, 27 Nov 2020 00:39:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404339AbgKZSO6 (ORCPT + 99 others); Thu, 26 Nov 2020 13:14:58 -0500 Received: from shelob.surriel.com ([96.67.55.147]:40134 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404196AbgKZSO6 (ORCPT ); Thu, 26 Nov 2020 13:14:58 -0500 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kiLnD-0007lT-Rk; Thu, 26 Nov 2020 13:14:55 -0500 Message-ID: <8f2428a049f2c29f092782699bcb3af76bf72b6a.camel@surriel.com> Subject: Re: [PATCH 3/3] mm,thp,shmem: make khugepaged obey tmpfs mount flags From: Rik van Riel To: Vlastimil Babka , hughd@google.com Cc: xuyu@linux.alibaba.com, akpm@linux-foundation.org, mgorman@suse.de, aarcange@redhat.com, willy@infradead.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, linux-mm@kvack.org, mhocko@suse.com Date: Thu, 26 Nov 2020 13:14:55 -0500 In-Reply-To: References: <20201124194925.623931-1-riel@surriel.com> <20201124194925.623931-4-riel@surriel.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-pjHMC/LhDPh+SjBdooxx" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Sender: riel@shelob.surriel.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-pjHMC/LhDPh+SjBdooxx Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2020-11-26 at 18:18 +0100, Vlastimil Babka wrote: > On 11/24/20 8:49 PM, Rik van Riel wrote: > > Currently if thp enabled=3D[madvise], mounting a tmpfs filesystem > > with huge=3Dalways and mmapping files from that tmpfs does not > > result in khugepaged collapsing those mappings, despite the > > mount flag indicating that it should. > >=20 > > Fix that by breaking up the blocks of tests in hugepage_vma_check > > a little bit, and testing things in the correct order. > >=20 > > Signed-off-by: Rik van Riel > > Fixes: c2231020ea7b ("mm: thp: register mm for khugepaged when > > merging vma for shmem") >=20 > Looks ok. But, it we have sysfs thp enabled=3Dnever, and shmem mount > explicitly=20 > thp enabled, then shmem mount overrides the global sysfs setting and > thp's will=20 > be allocated there, right? However, khugepaged_enabled() will be > false and thus=20 > khugepaged won't run at all? So a similar situation than what you're > fixing here. Indeed, that is somewhat similar. Whether or not shmem allocations attempt huge pages is controlled by both the file /sys/kernel/mm/transparent_hugepage/shmem_enabled and mount options. This patch makes khugepaged treat the mount options and/or sysfs flag as enabling collapsing of huge pages in case enabled =3D [always] for regular THPs. Should I send another patch on top of this that causes khugepaged to be enabled when regular THPs are disabled, but shmem THPs are enabled in any way? --=20 All Rights Reversed. --=-pjHMC/LhDPh+SjBdooxx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAl+/8J8ACgkQznnekoTE 3oNbZgf/diF51qurPmCQ6k1Qm78hFdIIcawa0JQGueXEj9erGFEInRK6t0fHlhKM FdbfTqlwRq1bPMQiuTvdDkpKHr/D1wX4aDh9UnAQ4oeOLsLHwF1k+HJh/XRjjDmx WwF68eL6mR6nNX28xjB7IPE9j3TjcHKHHrIcl0zhohf9zfv3Clk+idnFbO/1W8ns 9WBfK1+QClmspFfTw91d9nh20Q0m0sYL15CoEymbl+VKu3CIq6Cwf3IGIRJkmmtN 3u5HIiaBUyZrflSaLJcvqAkwg/afi5nPdDuAhgXA6WyW+c4ICRgyOQthZ2EWN/bE OIcIgCHTz4a1+AguzTF9AEpw7R+Flw== =/Xou -----END PGP SIGNATURE----- --=-pjHMC/LhDPh+SjBdooxx--