Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp116923imm; Fri, 3 Aug 2018 00:08:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcOzw1JcauLeiYKxQozAxGQA4L256ZqW1b1mBl+EIId744zymn5GwLus/+rRzaYMzMj0hjy X-Received: by 2002:a63:1a20:: with SMTP id a32-v6mr2483564pga.446.1533280112347; Fri, 03 Aug 2018 00:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533280112; cv=none; d=google.com; s=arc-20160816; b=m8wn/gB/AL9q1aj+SZ3TvBiSTPXRsvgyuqwkoAdho0wxzqsCPX4FzuxlizLFL9WsJc ZZAqOCPpNaum/s8GjECMkSsiesl9pFR62CidnrCI2nyPru57RKgqrDExm6WO7E44Nuqk Rz0hpyaEqtFy9C9gljK8AHLaKTGT5xWVrV1qCWlh16Eoa5KNe16RRVjbfhTtb+G5eKS1 PRUeC6ZY75jM7/4wCaHuCYkG1dPSGh5x47hgC4K6sKFOukyiZQHI9lnk8P7VMIa9xTdF uaqWzlFkz6JwY2sJDeT+1+Ukvv6/yocoYHx0rPTCMafUpE5Ju+eSWIV+AajyRptPfScv 1w3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=lVrhTnRjEJ5qO5Vw92MS874YoHbwH7M/oXNae7tcB3Y=; b=NTzwOlHtBxX5KGz+53XcZcejyU0ifryEe2b3FfSVZjnd1XDwO0QwxKCBbYWkRVThcV 5LteEbpzA7Zo2SLSeQcavBXsN71qljKWYqB3ySRFrAVspPHSzkWPkBdoAMm6J6i8nlLO iT22lKIb5hYZwxiwMNRrxC2kIltDTUQ5TSL8ZQQEdmDYS/1zLS2Q0adk8cupEt6coQYq Dmd3S6jg/mHkQR3h15czukUKI6f1gIHnprotAbX+iKUJaOY2yDaHePZdGXEcjjhADk3D oXXIXJdYmu2+lgGX7VpF2CcMyDEhB9dr1c5wbGrxf7Os1R8OXkc0ysJ91qiehu5RXGsG JM3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2-v6si3567562pge.74.2018.08.03.00.08.17; Fri, 03 Aug 2018 00:08:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729601AbeHCJCR (ORCPT + 99 others); Fri, 3 Aug 2018 05:02:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:60742 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728598AbeHCJCQ (ORCPT ); Fri, 3 Aug 2018 05:02:16 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D82B0ACD2; Fri, 3 Aug 2018 07:07:21 +0000 (UTC) Date: Fri, 3 Aug 2018 09:07:20 +0200 From: Michal Hocko To: Zhaoyang Huang Cc: Steven Rostedt , Ingo Molnar , Johannes Weiner , Vladimir Davydov , "open list:MEMORY MANAGEMENT" , cgroups@vger.kernel.org, LKML , kernel-patch-test@lists.linaro.org Subject: Re: [PATCH v1] mm:memcg: skip memcg of current in mem_cgroup_soft_limit_reclaim Message-ID: <20180803070720.GG27245@dhcp22.suse.cz> References: <1533275285-12387-1-git-send-email-zhaoyang.huang@spreadtrum.com> <20180803061817.GC27245@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 03-08-18 14:59:34, Zhaoyang Huang wrote: > On Fri, Aug 3, 2018 at 2:18 PM Michal Hocko wrote: > > > > On Fri 03-08-18 14:11:26, Zhaoyang Huang wrote: > > > On Fri, Aug 3, 2018 at 1:48 PM Zhaoyang Huang wrote: > > > > > > > > for the soft_limit reclaim has more directivity than global reclaim, we40960 > > > > have current memcg be skipped to avoid potential page thrashing. > > > > > > > The patch is tested in our android system with 2GB ram. The case > > > mainly focus on the smooth slide of pictures on a gallery, which used > > > to stall on the direct reclaim for over several hundred > > > millionseconds. By further debugging, we find that the direct reclaim > > > spend most of time to reclaim pages on its own with softlimit set to > > > 40960KB. I add a ftrace event to verify that the patch can help > > > escaping such scenario. Furthermore, we also measured the major fault > > > of this process(by dumpsys of android). The result is the patch can > > > help to reduce 20% of the major fault during the test. > > > > I have asked already asked. Why do you use the soft limit in the first > > place? It is known to cause excessive reclaim and long stalls. > > It is required by Google for applying new version of android system. > There was such a mechanism called LMK in previous ANDROID version, > which will kill process when in memory contention like OOM does. I > think Google want to drop such rough way for reclaiming pages and turn > to memcg. They setup different memcg groups for different process of > the system and set their softlimit according to the oom_adj. Their > original purpose is to reclaim pages gentlely in direct reclaim and > kswapd. During the debugging process , it seems to me that memcg maybe > tunable somehow. At least , the patch works on our system. Then the suggestion is to use v2 and the high limit. This is much less disruptive method for pro-active reclaim. Really softlimit semantic is established for many years and you cannot change it even when it sucks for your workload. Others might depend on the traditional behavior. I have tried to change the semantic in the past and there was a general consensus that changing the semantic is just too risky. So it is nice that it helps for your particular workload but this is not an upstream material, I am sorry. -- Michal Hocko SUSE Labs