Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7745517imu; Mon, 3 Dec 2018 18:55:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/WQb2bhUUSZ3+pF8C20H5aB/i+ZcYXPqjCMOXPnu3RZR4z6/6fkpiILk028vl0HUdbjN4s1 X-Received: by 2002:a17:902:6b49:: with SMTP id g9mr18090078plt.98.1543892129502; Mon, 03 Dec 2018 18:55:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543892129; cv=none; d=google.com; s=arc-20160816; b=BCQ7Tl2b3+Lic5y4ktCn0Kb7uwooZ9YsqaaI2DaDH8qRMZfKUXwqnl4j0JXecxQPcq je49AIUcljlMo+NOlBFWl8LT+5qSFx5q1KhtP2S3DcXpCUywfBG+9SPX3wveiJ9KYegH JsnrrmR2lE4YHWhec5HBk7tRCNcfEP4LbnWMSM7HhTFLz797hi9hr3qHG/qZBLYqqf8t QJklEo7n7/gMDg1d0plDa8HmR4V7RGGyESDppHEbu5nCkuZ8acY6K1Ois1gI1RVGCazc 0KcWCjELqY3xNF4TM5GthwgXdJuav9psLdiKCYCvLiUzRJSXZDgFeGZJrVOuQFTgr3IW a2fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:reply-to; bh=rhE6sARwrqASoDK0ZxwZRMxBfTiRrgZnDpqCDe3zuJQ=; b=zWDYq/33LNIv5lMHB0aASjXjHWNwZ/aIyybNvV7IIqzRFkE0v+rYXGY4nRyZlVFdW0 ewyQa/pl4FmHPXc2DKDUfCc8HQF6uSoV0qe+KNQc4yF6vgXQs5ZQ8k4JSaDyhx+ISkne AR5hHeD6d+vJz9Gb6NatRjZ0BniLKJb6D1DrIzqWwb2DfJIgBNWcUXPTQ7Sw3KVWuVWl rfBWUslCntNBup254xWUKIOpAYj00UB7qfiEdgl/KYfTAwEDUZVZRg1NlK2o5bH65Yby Wufi1EpiyMPQeLrw1boMbKtE8i8UrEAsScEttSBOkmNBtcwG0rjrRk2w1giE6cUi1lZr X8xA== 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e34si14618223pgb.80.2018.12.03.18.55.02; Mon, 03 Dec 2018 18:55:29 -0800 (PST) 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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725995AbeLDCxs (ORCPT + 99 others); Mon, 3 Dec 2018 21:53:48 -0500 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:38707 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725971AbeLDCxr (ORCPT ); Mon, 3 Dec 2018 21:53:47 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07417;MF=xlpang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TEowmpW_1543892012; Received: from xunleideMacBook-Pro.local(mailfrom:xlpang@linux.alibaba.com fp:SMTPD_---0TEowmpW_1543892012) by smtp.aliyun-inc.com(127.0.0.1); Tue, 04 Dec 2018 10:53:33 +0800 Reply-To: xlpang@linux.alibaba.com Subject: Re: [PATCH 3/3] mm/memcg: Avoid reclaiming below hard protection To: Michal Hocko Cc: Roman Gushchin , Johannes Weiner , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20181203080119.18989-1-xlpang@linux.alibaba.com> <20181203080119.18989-3-xlpang@linux.alibaba.com> <20181203115736.GQ31738@dhcp22.suse.cz> From: Xunlei Pang Message-ID: <8d8e860d-f9a4-6708-ccab-d47180f0ad0a@linux.alibaba.com> Date: Tue, 4 Dec 2018 10:53:32 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <20181203115736.GQ31738@dhcp22.suse.cz> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/12/3 PM 7:57, Michal Hocko wrote: > On Mon 03-12-18 16:01:19, Xunlei Pang wrote: >> When memcgs get reclaimed after its usage exceeds min, some >> usages below the min may also be reclaimed in the current >> implementation, the amount is considerably large during kswapd >> reclaim according to my ftrace results. > > And here again. Describe the setup and the behavior please? > step 1 mkdir -p /sys/fs/cgroup/memory/online cd /sys/fs/cgroup/memory/online echo 512M > memory.max echo 409600000 > memory.min echo $$ > tasks dd if=/dev/sda of=/dev/null while true; do sleep 1; cat memory.current ; cat memory.min; done step 2 create global memory pressure by allocating annoymous and cached pages to constantly trigger kswap: dd if=/dev/sdb of=/dev/null step 3 Then observe "online" groups, hundreds of kbytes a little over memory.min can cause tens of MiB to be reclaimed by kswapd. Here is one of test results I got: cat memory.current; cat memory.min; echo; 409485312 // current 409600000 // min 385052672 // See current got over reclaimed for 23MB 409600000 // min Its corresponding ftrace output I monitored: kswapd_0-281 [000] .... 304.706632: shrink_node_memcg: min_excess=24, nr_reclaimed=6013, sc->nr_to_reclaim=1499997, exceeds 5989pages