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=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 9AD17C2D0A3 for ; Thu, 12 Nov 2020 10:53:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0CBFD22201 for ; Thu, 12 Nov 2020 10:53:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="rHTa/6ku" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CBFD22201 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 736946B005D; Thu, 12 Nov 2020 05:53:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E83F6B0068; Thu, 12 Nov 2020 05:53:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D6DC6B006C; Thu, 12 Nov 2020 05:53:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id 2E8866B005D for ; Thu, 12 Nov 2020 05:53:02 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C59C78249980 for ; Thu, 12 Nov 2020 10:53:01 +0000 (UTC) X-FDA: 77475453762.08.blade17_090d3dd27305 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id A1B671819E764 for ; Thu, 12 Nov 2020 10:53:01 +0000 (UTC) X-HE-Tag: blade17_090d3dd27305 X-Filterd-Recvd-Size: 3256 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 10:53:01 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1605178380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q92i3jNFlDey2zfzOmaWmIpJgWWQB2STitndo/BWuxQ=; b=rHTa/6kuqazJebjOzKki+k8mtd8HRIuwA5B+WZy0sAyq74Ed5hTyfGkAuPT4xhnHZkYN3u O1MIePLOj8AicNhgmrF5ufCHzV2gmDwWt5WaNmjipXGsiCeLlBiNvsHmxKgcP/8heR2Io7 qOm9xya+v5yrOEs+z/YsUGlmWejMy4M= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DC631AF21; Thu, 12 Nov 2020 10:52:59 +0000 (UTC) Date: Thu, 12 Nov 2020 11:52:58 +0100 From: Michal Hocko To: Rik van Riel 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 Subject: Re: [PATCH 1/2] mm,thp,shmem: limit shmem THP alloc gfp_mask Message-ID: <20201112105258.GZ12240@dhcp22.suse.cz> References: <20201105191508.1961686-1-riel@surriel.com> <20201105191508.1961686-2-riel@surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201105191508.1961686-2-riel@surriel.com> 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: On Thu 05-11-20 14:15:07, 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. I believe you should also exaplain why we want to control defrag by the global knob while the enable logic is per mount. > 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. This begs some numbers. A little is rather bad unit of performance. I do agree that unifying those makes sense in general though. > Signed-off-by: Rik van Riel > --- > include/linux/gfp.h | 2 ++ > mm/huge_memory.c | 6 +++--- > mm/shmem.c | 8 +++++--- > 3 files changed, 10 insertions(+), 6 deletions(-) -- Michal Hocko SUSE Labs