Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1051225pxb; Fri, 26 Feb 2021 00:56:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJywCIPRGBZBH6EMQb/FXDM3+UiOc89UIjdqBp+rV27Ttf4DFJw+zV7gTn0iMTqUtUt6Qf/A X-Received: by 2002:a17:906:e0b:: with SMTP id l11mr2190826eji.523.1614329760274; Fri, 26 Feb 2021 00:56:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614329760; cv=none; d=google.com; s=arc-20160816; b=hKHioUifQao3tFAzq3nws+1gMM5lIGL0VrYKqkRUOqbmuedeHs3yxyamVQpxa4HfB/ NRuxLUKyiBMgqKmUFI2gLDTd2kOImiNrIR9tfyXHEsTLrPm0WR2pKsWf3ctgHZ3enn0X HEuEutxGKaVt79uDfky+mjjn7sJMGlZtikn2Ii5/pS2Yv5qqEcFTgy921+srtpQHrVQe HlZw6N5dHA1u5CkbYWmrOue3zk2QzLJ8H/sqKYKqyeOoBJ70ncsCn5jMa/Kl594Kg3RQ JiJLHAE63M5zSEIIcauo3omqhNJwO5JOUBfcl1hDr8dBIxtgLX8hY942Kg3cZdDH+0U3 24aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NV8HHUAhGyMKMdxJOAqWE34D2NQYX6VFUHRpOEastO8=; b=e4Vm8Fc8OwtpWaNlsN423UhsyR7o8sxMelU08w8bPVQAPNH/xL66k3EnmhRRhSRhqD GfmwxXK5fatqZLTNs1gtrBzfp9K99qW+iQ9vY6KoEVFO0FAxXs9SeQlIBEti7K34t88/ NdO7FJWBAMIpUCPbyWELlK/2uw+bmXk2qr/htt/Fo1yWS+RwzsR/qOyVAafcxTIHWbXO Kw52zNQYgqZtFPvOEwW2hLJ0CAIIkQ0/2eECDwANZ3gnuxEpcoPfWxgG6XEfc4OlK4Bo eqX6qUDHFTJLjxcmPgimyi/Ikhtc4IVIJ/veU4mtZDPzCHkeo/yjJXnp2ZY1KWLo/01r 90Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=G45FTSyW; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si5618765ejn.727.2021.02.26.00.55.38; Fri, 26 Feb 2021 00:56:00 -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; dkim=pass header.i=@suse.com header.s=susede1 header.b=G45FTSyW; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbhBZIw6 (ORCPT + 99 others); Fri, 26 Feb 2021 03:52:58 -0500 Received: from mx2.suse.de ([195.135.220.15]:55790 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbhBZIw4 (ORCPT ); Fri, 26 Feb 2021 03:52:56 -0500 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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