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 4C00CC433E0 for ; Fri, 26 Feb 2021 08:52:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C05D564EC3 for ; Fri, 26 Feb 2021 08:52:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C05D564EC3 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 3274B6B006C; Fri, 26 Feb 2021 03:52:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D72C6B006E; Fri, 26 Feb 2021 03:52:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B2B38D0001; Fri, 26 Feb 2021 03:52:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id 055E86B006C for ; Fri, 26 Feb 2021 03:52:12 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BCA39BBE3 for ; Fri, 26 Feb 2021 08:52:11 +0000 (UTC) X-FDA: 77859802062.18.440D774 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf01.hostedemail.com (Postfix) with ESMTP id 9B2112000385 for ; Fri, 26 Feb 2021 08:52:10 +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=1614329530; 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=NV8HHUAhGyMKMdxJOAqWE34D2NQYX6VFUHRpOEastO8=; b=G45FTSyWYpZtUtKeL8sHnB58FYPM4Bd7jXJ+v5/01Mo/i//UxfXkkRztJDF1yupehrb0uU +xshvAAQtIbQJ1sGTw8tyBnADadr6LGtauQGeLOJ3AHbCjViqimAZ1H4ZoHyqlDLFT3Hq/ 4WJyi+qk+V7ApnoGE+7U+2qs6aRu0cU= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1C97DAAAE; Fri, 26 Feb 2021 08:52:10 +0000 (UTC) Date: Fri, 26 Feb 2021 09:52:09 +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: 9B2112000385 X-Stat-Signature: u4b6nsu3df9uhdqik43p6c4s9wyrxi1h Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf01; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614329530-346847 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 25-02-21 14:48:58, Tim Chen wrote: > > > On 2/24/21 3:53 AM, Michal Hocko wrote: > > 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. > > > Michal, > > Let's take an extreme case where memcg 1 always generate the > first event and memcg 2 generates the rest of 128*8-1 events > and the pattern repeat. I do not follow. Events are per-memcg, aren't they? __this_cpu_read(memcg->vmstats_percpu->targets[target]); [...] __this_cpu_write(memcg->vmstats_percpu->targets[target], next); -- Michal Hocko SUSE Labs