Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp684137pxu; Thu, 26 Nov 2020 09:01:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzP59PTDYj3JuIebLR3NI73NHjmDBcxJGtz62A8dud7BP/4gVsvXjK66hfbKE0HPk6M+/ek X-Received: by 2002:ac2:5f90:: with SMTP id r16mr1731105lfe.594.1606410106835; Thu, 26 Nov 2020 09:01:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606410106; cv=none; d=google.com; s=arc-20160816; b=qJ2WuqMI+lnYR0p6zr5Dec96y7E0khJXtqgcfTRUw4yQ01Pl+iimCn+Ex3Qbt7Uy30 D8adV8R9em42/RHdzQm+/ohm3ono+fCKqHt8/Xy+NaP96daL4862P0SEgvR/o0uRobnK z8DKbWdv4iEH7zpQN+J80XefkGwfCQJZY/DWsi2fb05FkjZimR0agTdqnyXJ8+TYDw0z Wd731sBq+PD2NQq8Siwca4D+H+hvmc4bI458eoJikXPqBz37N9ep7XRjwLi69PxfPaGq IQ7anm5OsKds+VB2J60IZ/A8bIUg7jrTT7wPxJ+GSyEEscF8MQiWN1UKJS7h3EWGQCu5 NK6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=wSskDsMfV1Yh7K866AK+TOKjHh9dV4GWVkP4sgSqgXU=; b=aMtZdcu46/Si0akhxN2hQbLQ+YL5NXFmEBw6EHgyZc9SHmdTVau0qkwYRsLHUt2n8p 9anOiNZwwsll7TaMp+kSZByI1bWqi/BclxpCb94DbfzUmEISshW/SR6qC1QQ7fUR1K6T bT7q6gGx8i/sRmNhGqHvCYoclBr49hqqgNJNmsyfISK0O3aoAWlIEwsJKB88XPi4fvo8 EMZ4ykxdki9ZV7X/H/7K8ot9jBxjfaFupyKOOrxG13naQpq5caVZTMVuGHOhg20v50p5 dHOjUIEObbOEfEcLzCPxyCPE4OegM4EYXA0ZzKYo+b9Yk17SaiQAxsvTfKlauovGV9ba 8jpw== 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 dx21si3921142ejb.657.2020.11.26.09.01.23; Thu, 26 Nov 2020 09:01:46 -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 S2403841AbgKZQ4t (ORCPT + 99 others); Thu, 26 Nov 2020 11:56:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:33058 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391237AbgKZQ4s (ORCPT ); Thu, 26 Nov 2020 11:56:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C1125ACE0; Thu, 26 Nov 2020 16:56:47 +0000 (UTC) Subject: Re: [PATCH 1/3] mm,thp,shmem: limit shmem THP alloc gfp_mask To: Rik van Riel , 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 References: <20201124194925.623931-1-riel@surriel.com> <20201124194925.623931-2-riel@surriel.com> From: Vlastimil Babka Message-ID: <18cea0b2-1037-3276-1d42-2a4adcc129e4@suse.cz> Date: Thu, 26 Nov 2020 17:56:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201124194925.623931-2-riel@surriel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/24/20 8:49 PM, Rik van Riel wrote: > The allocation flags of anonymous transparent huge pages can be controlled > through the files in /sys/kernel/mm/transparent_hugepage/defrag, which can > help the system from getting bogged down in the page reclaim and compaction > code when many THPs are getting allocated simultaneously. > > However, the gfp_mask for shmem THP allocations were not limited by those > configuration settings, and some workloads ended up with all CPUs stuck > on the LRU lock in the page reclaim code, trying to allocate dozens of > THPs simultaneously. > > This patch applies the same configurated limitation of THPs to shmem > hugepage allocations, to prevent that from happening. > > Controlling the gfp_mask of THP allocations through the knobs in > sysfs allows users to determine the balance between how aggressively > the system tries to allocate THPs at fault time, and how much the > application may end up stalling attempting those allocations. > > 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. > > 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. > > Signed-off-by: Rik van Riel Acked-by: Vlastimil Babka