Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1641986pxb; Fri, 13 Nov 2020 19:48:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4F3aPZVEQDik4JnUK263/9d2aGuOCVJtb4FrXCYqi7AVmE1c+xyhohiX6SOmSW8w0iG9w X-Received: by 2002:a50:9518:: with SMTP id u24mr6001983eda.124.1605325739401; Fri, 13 Nov 2020 19:48:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605325739; cv=none; d=google.com; s=arc-20160816; b=CyFEPwBBSWdrVufGMxyqzDuCOrQFXedFt7SPukdSRVirK0uG/JEzrjvZN3+5+FDfy2 CFjiv+E5SWcDO23LtUdg/EiYdkC069oHswO73LnldTALVffVwt8L16/bz7whOV6gnIal GDaN1F9cqrcKXsKOdxPRS/epqlYRRBp3zdrTJ+KPAkqSU6NRxxDilZQpZf3rQy7eqw7s F7yWD3B4kwpYMxEFc287DqCwxo5GnJHyMq4/Q251JUAkXRhAG2nqqQfDnb5VuRYgOI7O kmTsWRCIZLcQJvLB6YXMaYDrZRyg+qdhg8E05CCDEVw/rcmuEnpo6WOJAK01Tfxx5i/o +6QA== 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=bKWbhFkXGz1YVFS2ecABn+YSjYCGBhK/Nfdk+o1Bwm4=; b=Xlb9U45/h+QQpRgU0wy7wilwfCEDVujPr9egWw7t8SBp7cgmnbMXJ6eTayqsb6b/K/ CkiYl/seo/qlwWxkpJvTt2IwJr/tr+d2AxlFAUOieqcyis+Ojh3NH/vYXYHhbJmW0IX9 p3GqSpdGGYvwUPUqVCtjL94Iv04ZIG78nLcGXyKC92RX6CqNj97saeXLVzsaiJ9cnJ68 3Mk3iFe/RZCKr9HGyfmgYyytJ16W63/BsAh7wAsrbNZ2mwdlnb7d6cyN/1Ut66higjmS b5wT22ehF2KMxWup3/f54UOrbCv5fITNTehzBn4ccyuIBQlpgGO1hK78UGrPO73+bkXA Hftw== 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 ec18si7266398ejb.679.2020.11.13.19.48.35; Fri, 13 Nov 2020 19:48:59 -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 S1726276AbgKNDoV (ORCPT + 99 others); Fri, 13 Nov 2020 22:44:21 -0500 Received: from shelob.surriel.com ([96.67.55.147]:35042 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbgKNDoV (ORCPT ); Fri, 13 Nov 2020 22:44:21 -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 1kdmU8-0001JI-Om; Fri, 13 Nov 2020 22:44:20 -0500 Message-ID: <84effe90c3ee13fbfa6e732d2e3b3d9b557d1be1.camel@surriel.com> Subject: Re: [PATCH 1/2] mm,thp,shmem: limit shmem THP alloc gfp_mask From: Rik van Riel To: Michal Hocko Cc: hughd@google.com, 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, vbabka@suse.cz Date: Fri, 13 Nov 2020 22:44:20 -0500 In-Reply-To: <20201112105258.GZ12240@dhcp22.suse.cz> References: <20201105191508.1961686-1-riel@surriel.com> <20201105191508.1961686-2-riel@surriel.com> <20201112105258.GZ12240@dhcp22.suse.cz> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-otlc1Hj05zsRUDVw4HK7" 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 --=-otlc1Hj05zsRUDVw4HK7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2020-11-12 at 11:52 +0100, Michal Hocko wrote: > On Thu 05-11-20 14:15:07, Rik van Riel wrote: > >=20 > > This patch applies the same configurated limitation of THPs to > > shmem > > hugepage allocations, to prevent that from happening. >=20 > I believe you should also exaplain why we want to control defrag by > the > global knob while the enable logic is per mount. I added that to the changelog for the next version of the patches. > > This way a THP defrag setting of "never" or "defer+madvise" will > > result > > in quick allocation failures without direct reclaim when no 2MB > > free > > pages are available. > >=20 > > With this patch applied, THP allocations for tmpfs will be a little > > more aggressive than today for files mmapped with MADV_HUGEPAGE, > > and a little less aggressive for files that are not mmapped or > > mapped without that flag. >=20 > This begs some numbers. A little is rather bad unit of performance. I > do > agree that unifying those makes sense in general though. The aggressiveness is in changes to the gfp_mask, eg by adding __GFP_NORETRY. How that translates into THP allocation success rates is entirely dependent on the workload and on what else is in memory at the time. I am not sure any numbers I could gather will be representative for anything but the workloads I am testing. However, I did find an issue in hugepage_vma_check that prevents khugepaged from collapsing pages on shmem filesystems mounted with huge=3Dalways or huge=3Dwithin_size when transparent_hugepage/enabled is set to [madvise]. The next version of the series will have a third patch, in order to fix that. --=20 All Rights Reversed. --=-otlc1Hj05zsRUDVw4HK7 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+vUpQACgkQznnekoTE 3oMiXAgAqQFQLZCkPNXA5l/N7WEMWji2pTMavF9GX5YIzJD5EowvnAUv4EQvyFFN ZMYSkoHVvQSHiT3OqdrWMXEgx/FJU1aSj0DQX9GWYtA8QLR30WeDReqmlD6P//Ud FB37RuszfWHMh/hSdtrk0BrvSVtPAxEiFitPFEsek8WRTUIkMaaiwigIcrL77ooB 5Q1AuNhA4UplVmdG3dZlHB6J8ECPIYkSk/bmYviraDmwqFW17tkUwzl+S6cBGncd Ay0TmrHQvII+a+HCdT11I1QJlgp4dDMg2Cbc2VEVK0pZoAsEGuyS3j0bPRxoxV3u 6Hd4G/mGZhXxPuVoMxKx8z2hFAB8Lg== =ZErD -----END PGP SIGNATURE----- --=-otlc1Hj05zsRUDVw4HK7--