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 8AAD5C001B5 for ; Fri, 26 Aug 2022 21:22:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4051940008; Fri, 26 Aug 2022 17:22:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC829940007; Fri, 26 Aug 2022 17:22:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6827940008; Fri, 26 Aug 2022 17:22:11 -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 9102F940007 for ; Fri, 26 Aug 2022 17:22:11 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 60760120520 for ; Fri, 26 Aug 2022 21:22:11 +0000 (UTC) X-FDA: 79843016862.13.C3EE956 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf07.hostedemail.com (Postfix) with ESMTP id 13E8F40020 for ; Fri, 26 Aug 2022 21:22:09 +0000 (UTC) Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oRgj3-0000ZA-44; Fri, 26 Aug 2022 17:18:49 -0400 Message-ID: <6448b9a8dba8ef39e42e56a3c0ce0633fff7c6a6.camel@surriel.com> Subject: Re: [RFC 2/3] mm: changes to split_huge_page() to free zero filled tail pages From: Rik van Riel To: David Hildenbrand , alexlzhu@fb.com, linux-mm@kvack.org Cc: willy@infradead.org, hannes@cmpxchg.org, akpm@linux-foundation.org, kernel-team@fb.com, linux-kernel@vger.kernel.org Date: Fri, 26 Aug 2022 17:18:48 -0400 In-Reply-To: References: <490fcdd204ae129a2e43614a569a1cf4bdde9196.1661461643.git.alexlzhu@fb.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-t7auAH4ZwjgMioVwL5kI" User-Agent: Evolution 3.42.4 (3.42.4-1.fc35) MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661548931; a=rsa-sha256; cv=none; b=DEbOurQBx62KyBxwkq5ladF/KGyuF8eM6fzuhC/V+oAKSOjKhP3hS+n2Tm31UfAHbxznN+ reBxVq6SE3KTCl4A0pBJtG3pylRHe/+tjY+KMPT+q0d4BSkFhimEwAODalo51IuhrOHLR8 I+lAbzR7lbA4HX7Zo7CDgDwgV4iBhYM= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=none; spf=none (imf07.hostedemail.com: domain of riel@shelob.surriel.com has no SPF policy when checking 96.67.55.147) smtp.mailfrom=riel@shelob.surriel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661548931; h=from:from:sender: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: in-reply-to:in-reply-to:references:references; bh=sjsiqAXpoV6Uqg9SHWiMRag4T36iqQpdi4R343v+Ux0=; b=fhZTEcZGMLOAIFBtgk3idy7Yyp74MslmHq7VaeMWNOwVcTJ27wRhEfLfVbRjASEKv2puBA wXKSU/gUl8yct12kBhpbYJphs84lOEZnNwH2jRZeKPfsDgcWt/IwS0IN6MtauQG8l63PeK oT+bz96WrEXmyGkKfjsCpXCzt7xzX00= X-Rspam-User: Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=none; spf=none (imf07.hostedemail.com: domain of riel@shelob.surriel.com has no SPF policy when checking 96.67.55.147) smtp.mailfrom=riel@shelob.surriel.com X-Rspamd-Server: rspam10 X-Stat-Signature: b85g8jp5zgkmsad3xgc7y8zg55jkmfxn X-Rspamd-Queue-Id: 13E8F40020 X-HE-Tag: 1661548929-558406 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: --=-t7auAH4ZwjgMioVwL5kI Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2022-08-26 at 12:18 +0200, David Hildenbrand wrote: > On 25.08.22 23:30, alexlzhu@fb.com=C2=A0wrote: > > From: Alexander Zhu > >=20 > > Currently, split_huge_page() does not have a way to identify zero > > filled > > pages within the THP. Thus these zero pages get remapped and > > continue to > > create memory waste. In this patch, we identify and free tail pages > > that > > are zero filled in split_huge_page(). In this way, we avoid mapping > > these > > pages back into page table entries and can free up unused memory > > within > > THPs.=20 > >=20 >=20 > Isn't this to some degree splitting the THP (PMDs->PTEs + dissolve > compound page) and then letting KSM replace the zero-filled page by > the > shared zeropage? >=20 Many systems do not run KSM, though, and even on the systems where it does, KSM only covers a subset of the memory in the system. I could see wanting to maybe consolidate the scanning between KSM and this thing at some point, if it could be done without too much complexity, but keeping this change to split_huge_page looks like it might make sense even when KSM is enabled, since it will get rid of the unnecessary memory much faster than KSM could. Keeping a hundred MB of unnecessary memory around for longer would simply result in more THPs getting split up, and more memory pressure for a longer time than we need. --=20 All Rights Reversed. --=-t7auAH4ZwjgMioVwL5kI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAmMJOLgACgkQznnekoTE 3oOSiwf/Z0jX3IxD6abgm8xNOn+XsJMaGEfbsbN2b6y266szPkcPOnKshck+4BkK 7pU5kcT/uNiqQp98UKVmHtbVtE/W+5K135IjeZyn+hd1zmye7NLAsuXWQ3U0hsBx 21iFKOseM5WK06IrnoAPklu/x4p5wKNmEFnV7Dz3mFK/mXfhbDG6gnMwknJXKty8 6sGONhpIYoyLWqIFmOYzX/IWHu8V9PabtIPk7aiZjQvnOL5WqSrEYiC24mZoq+8m 5UbKd/9kY9p9YMMw31IAL453BxlYcYHU1CdqdOAzZnF9L+HD82QTJ5gnQ41/hyhi VgW/QDY9OHdSYtQKdyntQyxxbVuLHw== =+VGD -----END PGP SIGNATURE----- --=-t7auAH4ZwjgMioVwL5kI--