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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 D713EC433E9 for ; Wed, 24 Feb 2021 11:53:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F96064ED1 for ; Wed, 24 Feb 2021 11:53:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F96064ED1 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine 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 901836B0006; Wed, 24 Feb 2021 06:53:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B15F6B006C; Wed, 24 Feb 2021 06:53:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C6396B006E; Wed, 24 Feb 2021 06:53:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 67E276B0006 for ; Wed, 24 Feb 2021 06:53:39 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2FF0D2489 for ; Wed, 24 Feb 2021 11:53:39 +0000 (UTC) X-FDA: 77853001758.25.FEAD191 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf02.hostedemail.com (Postfix) with ESMTP id 79930407F8F3 for ; Wed, 24 Feb 2021 11:53:25 +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=1614167617; h=from:from:reply-to: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=XzLsHGcL8bQEwd8q77IJXXPxrQFmDs82g85prap2dQ4=; b=nXir09DKObx9wu/my6Ugn5gdRgCXHFR7PCmDobwcx3KpR14Hr90pvWZwBEJmLtYJWI0B6R /7z86SKpQROZRhKPQ27B778WIRwrt3MZQrt6wYpdGaX1fLA4BtZg0qAxf16zW7CAYZFcpg onHSk/VsZtl2Lnilzk6yEZSaiE8fcvk= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 71AE5ADDB; Wed, 24 Feb 2021 11:53:37 +0000 (UTC) Date: Wed, 24 Feb 2021 12:53:35 +0100 From: Michal Hocko To: Tim Chen Cc: Andrew Morton , Johannes Weiner , Vladimir Davydov , Dave Hansen , Ying Huang , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess Message-ID: References: <06f1f92f1f7d4e57c4e20c97f435252c16c60a27.1613584277.git.tim.c.chen@linux.intel.com> <884d7559-e118-3773-351d-84c02642ca96@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 79930407F8F3 X-Stat-Signature: ptfgdpzamzmpc7kdg5jka1nzaeq5hwkw Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614167605-234886 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 Mon 22-02-21 11:48:37, Tim Chen wrote: > > > On 2/22/21 11:09 AM, Michal Hocko wrote: > > >> > >> I actually have tried adjusting the threshold but found that it doesn't work well for > >> the case with unenven memory access frequency between cgroups. The soft > >> limit for the low memory event cgroup could creep up quite a lot, exceeding > >> the soft limit by hundreds of MB, even > >> if I drop the SOFTLIMIT_EVENTS_TARGET from 1024 to something like 8. > > > > What was the underlying reason? Higher order allocations? > > > > Not high order allocation. > > The reason was because the run away memcg asks for memory much less often, compared > to the other memcgs in the system. So it escapes the sampling update and > was not put onto the tree and exceeds the soft limit > pretty badly. Even if it was put onto the tree and gets page reclaimed below the > limit, it could escape the sampling the next time it exceeds the soft limit. I am sorry but I really do not follow. Maybe I am missing something obvious but the the rate of events (charge/uncharge) shouldn't be really important. There is no way to exceed the limit without charging memory (either a new or via task migration in v1 and immigrate_on_move). If you have SOFTLIMIT_EVENTS_TARGET 8 then you should be 128 * 8 events to re-evaluate. Huge pages can make the runaway much bigger but how it would be possible to runaway outside of that bound. Btw. do we really need SOFTLIMIT_EVENTS_TARGET at all? Why cannot we just stick with a single threshold? mem_cgroup_update_tree can be made a effectivelly a noop when there is no soft limit in place so overhead shouldn't matter for the vast majority of workloads. -- Michal Hocko SUSE Labs