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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4616AC56202 for ; Thu, 26 Nov 2020 18:15:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B66AD21D7F for ; Thu, 26 Nov 2020 18:14:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B66AD21D7F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2A1D36B0070; Thu, 26 Nov 2020 13:14:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 251C76B0072; Thu, 26 Nov 2020 13:14:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1693B6B0075; Thu, 26 Nov 2020 13:14:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0092.hostedemail.com [216.40.44.92]) by kanga.kvack.org (Postfix) with ESMTP id 0227B6B0070 for ; Thu, 26 Nov 2020 13:14:58 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B8DB3363F for ; Thu, 26 Nov 2020 18:14:58 +0000 (UTC) X-FDA: 77527370676.23.guide10_36150ef27381 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 8A8BB37606 for ; Thu, 26 Nov 2020 18:14:58 +0000 (UTC) X-HE-Tag: guide10_36150ef27381 X-Filterd-Recvd-Size: 3761 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Nov 2020 18:14:58 +0000 (UTC) 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 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: --=-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--