Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp110402imm; Fri, 3 Aug 2018 00:00:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfkFTe/uZxqcELEaq6YYXql30GJH9yoTc0OTyKOVZRVDf/J2ColMDMbNhWluhzmMaXJwAAe X-Received: by 2002:a17:902:20e3:: with SMTP id v32-v6mr2412260plg.232.1533279655599; Fri, 03 Aug 2018 00:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533279655; cv=none; d=google.com; s=arc-20160816; b=Bg6tCOatXS7vSr5dZNp5oAfig9Lw+2/tjTsbIbe7xwOKnU3QOOlMp/XBWvrj+yUXye C6O4VE+pRgBgmS9ZAP24YQ5Io3anBT1kqgAlWEzHJHmjhdTzNW0kv/7vBMcvBHSAgEFN UEckLvaS0REwoYzV5KKAK4lfDcA9mZzT/jHun4WsRx2Bdc27+STGu7jdtyPoBwSAf+wJ Fcu/hrAXvETI+dpqLBgtAa4bWVkBo9RfXvV/O30DeSg3bZI1a5i95230kjyZkZ67lMJC lSbCyU1YtpvuJ9H3przb/w4y1yy5i445Z2ET85mMv31NILTlYHmK8duYM502eANFD/7f iY2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=BToqHnruEFWzF4KUHIKkhBWJXabmmXG2JItTBWoDE9A=; b=chzQZlIkCRP0B3kOWLAA0WSnKSCsVvBXAv95lNUjF5nLkx2P0Rdj04wFlx4yrjhBzJ 7jaHGQg+smaDI3dX2RVjBXWwqdJ1tV4MOGEeLbjiXNNuSZYuTmtzJODZAdIUHM9NLDZx FUXjU0lwignmy8pFeIZFrPM9v3BN7GYi2BOycNkk22NNUIPXZK53ndAAo6Cr+0ckufIs olX1Wky5BuR3h6SRML6/qfUjPp/leZd6maOrZnOyUozeczIt3pkQN2foR4OgPzk+7kzo 8dYODeJ0O1Ct2s0jMlKdDehWkB6gjHZZMDvx0iASF2sv6Fa2OKIYxfY+8u89QIhW+HR/ Lnlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AwqSLeGZ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19-v6si3592737pgm.605.2018.08.03.00.00.39; Fri, 03 Aug 2018 00:00:55 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AwqSLeGZ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727680AbeHCIyi (ORCPT + 99 others); Fri, 3 Aug 2018 04:54:38 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:35580 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727192AbeHCIyi (ORCPT ); Fri, 3 Aug 2018 04:54:38 -0400 Received: by mail-ed1-f66.google.com with SMTP id e6-v6so1781887edr.2; Thu, 02 Aug 2018 23:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BToqHnruEFWzF4KUHIKkhBWJXabmmXG2JItTBWoDE9A=; b=AwqSLeGZK5m5u6wncTr1E+8DhwEtdc576vD/l3XObqxvhipo8UUR0ESryVfoR2ud5p uKJYUmM9+W7XYlG5B2tOnFa3EG6kzS+CLneYRp6g+374oP6u8hKtUcVCcq51WBUFoo5l 2rBT9Cg4gS5+rEQp7aC3irbuPnVmsgOWmIDKVuDkf32Ej4ckdomSC4MmHmdBR3KcisJW RVrl5dV4Wlltwz6NR0Qpj0CWc+ytG/JNT4veT5yRqxxxxQIN5tWeCxVpP3hRqdwE4ugA RtD4F6pwkggYk/q+lXBOjQ6/8lZ1WWbuLqQXILFbFuFuUTE6GxIR941H5kUpF/dK9e+1 OsYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BToqHnruEFWzF4KUHIKkhBWJXabmmXG2JItTBWoDE9A=; b=GxVaP25kdTyxvDI2rzvQm9x1k0f5xGSXr0TvRelhmXL4KhysAYfioPBQep7IxN1ALv G/3o/WtpDTupZCuK8KCcCGGXOyzpHIaYzYxagqG78iD1LfZIBRCPjoCkgo/t6loYDJP0 YIVLiPxF5oy0AfVdmO2OVUjlGUKHqbEXmo6YjayDsXiysFkqTeDvOTC158/xLFC/wIcH jWPfTfexOml1JWWGL9Syatob8/HuNujaeco77saw+J0QplW1ihT/xZi0N3kfcagsWkAV KiII7t3Mzh92yWOuL1ku+U8Ss48o2RLvyV3GDXBM7CKXlh6R33YZOV26gRcQUKz47QkT eH5g== X-Gm-Message-State: AOUpUlGA0wDvBGPq3Pt5ecnf0eV5T0xDshIOzvOgXZ4uwrPioOTuH/Nr EpLYVV3Z6hqJa5xdakgFQzxmWAUZtMQJbEfEyO8= X-Received: by 2002:a50:f4aa:: with SMTP id s39-v6mr6146169edm.262.1533279585238; Thu, 02 Aug 2018 23:59:45 -0700 (PDT) MIME-Version: 1.0 References: <1533275285-12387-1-git-send-email-zhaoyang.huang@spreadtrum.com> <20180803061817.GC27245@dhcp22.suse.cz> In-Reply-To: <20180803061817.GC27245@dhcp22.suse.cz> From: Zhaoyang Huang Date: Fri, 3 Aug 2018 14:59:34 +0800 Message-ID: Subject: Re: [PATCH v1] mm:memcg: skip memcg of current in mem_cgroup_soft_limit_reclaim To: Michal Hocko Cc: Steven Rostedt , Ingo Molnar , Johannes Weiner , Vladimir Davydov , "open list:MEMORY MANAGEMENT" , cgroups@vger.kernel.org, LKML , kernel-patch-test@lists.linaro.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > -- > Michal Hocko > SUSE Labs