Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7993843imu; Tue, 4 Dec 2018 00:46:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/WGajUUWFNdNgZT7/wfv0G8iXKEvupponv4r64zaQ7W72RFyDom7eYK9xhSb/4BYKR6O51E X-Received: by 2002:a17:902:4d46:: with SMTP id o6mr18286111plh.302.1543913191144; Tue, 04 Dec 2018 00:46:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543913191; cv=none; d=google.com; s=arc-20160816; b=yJufEiJ7qvKdXIVLbjeqavsFqAxN6k3gS2wDBlF8Quh++0x8DXIZFzhBbpd1MhqLfF tK0+6z2cBKcb6YkG/0DHl3uezSgfR3R7uw3eU4Yk9/r7jjpgQOb7m6YXpSGJKPPQXW9M ZxshsELJ/QUapCeLy4M+9qeOHiOVJA2D/JgaV+tR4riRrcUzbXzezRfzMudeFEswC34D C/kreQE5lJMTvecxwbqRsO2yYEHR6dD1PdQJVzeIftq31W2BvHkH2AVz/vRcHqy5vAuc vISWn9bbmER1htw6GBgLzu4dqgXaKuITJKdB6wipaqo5jzHGmq02QDftYJ2YPFjKGFVm Y9Tg== 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=ewgKOEtQWFMViiUXOOHKsd95OYF2ROFI8kUArX5+Tdg=; b=DbhwbjiHDnpsHlh/bO0s9DKEI8KqwJNh6TCYuduKH6Finp8ISXYXPAgNU3+zpdzyDp rLmzV60WSEu20sMq9p+Qd6Jkrizp4iJiqthRSe7S2B4mOTZodQp1O7JQusCUdCIMbukH Xgit8UAutPBBJHHI0DcCD/sZlurG5i6t57PaB6qI+ZBfTpgdJVsdsMAXsOm6e5gv4mTX b10j0h1WuCXlnaZbr037ADcsBTNNiF1uP/SYn7DJtXcyBX15ETnIL9ihFYBju7lCl+EK gca9ukOTohFjvaKuwROZb/5EmLHAYMLE5auaAXozYA0i/LsLXti7xN+r588hmkRwI2BH VsiA== 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 1si16873150pld.239.2018.12.04.00.46.16; Tue, 04 Dec 2018 00:46:31 -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 S1725859AbeLDIpc (ORCPT + 99 others); Tue, 4 Dec 2018 03:45:32 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:52739 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbeLDIpc (ORCPT ); Tue, 4 Dec 2018 03:45:32 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07487;MF=xlpang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TEqRxdG_1543913079; Received: from xunleideMacBook-Pro.local(mailfrom:xlpang@linux.alibaba.com fp:SMTPD_---0TEqRxdG_1543913079) by smtp.aliyun-inc.com(127.0.0.1); Tue, 04 Dec 2018 16:44:40 +0800 Reply-To: xlpang@linux.alibaba.com Subject: Re: [PATCH 2/3] mm/vmscan: Enable kswapd to reclaim low-protected memory 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-2-xlpang@linux.alibaba.com> <20181203115646.GP31738@dhcp22.suse.cz> <54a3f0a6-6e7d-c620-97f2-ac567c057bc2@linux.alibaba.com> <20181203172007.GG31738@dhcp22.suse.cz> <20181204072508.GU31738@dhcp22.suse.cz> From: Xunlei Pang Message-ID: <4e06fac2-7269-23a7-e4f5-18928998ece2@linux.alibaba.com> Date: Tue, 4 Dec 2018 16:44:40 +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: <20181204072508.GU31738@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/12/4 PM 3:25, Michal Hocko wrote: > On Tue 04-12-18 10:40:29, Xunlei Pang wrote: >> On 2018/12/4 AM 1:22, Michal Hocko wrote: >>> On Mon 03-12-18 23:20:31, Xunlei Pang wrote: >>>> On 2018/12/3 下午7:56, Michal Hocko wrote: >>>>> On Mon 03-12-18 16:01:18, Xunlei Pang wrote: >>>>>> There may be cgroup memory overcommitment, it will become >>>>>> even common in the future. >>>>>> >>>>>> Let's enable kswapd to reclaim low-protected memory in case >>>>>> of memory pressure, to mitigate the global direct reclaim >>>>>> pressures which could cause jitters to the response time of >>>>>> lantency-sensitive groups. >>>>> >>>>> Please be more descriptive about the problem you are trying to handle >>>>> here. I haven't actually read the patch but let me emphasise that the >>>>> low limit protection is important isolation tool. And allowing kswapd to >>>>> reclaim protected memcgs is going to break the semantic as it has been >>>>> introduced and designed. >>>> >>>> We have two types of memcgs: online groups(important business) >>>> and offline groups(unimportant business). Online groups are >>>> all configured with MAX low protection, while offline groups >>>> are not at all protected(with default 0 low). >>>> >>>> When offline groups are overcommitted, the global memory pressure >>>> suffers. This will cause the memory allocations from online groups >>>> constantly go to the slow global direct reclaim in order to reclaim >>>> online's page caches, as kswap is not able to reclaim low-protection >>>> memory. low is not hard limit, it's reasonable to be reclaimed by >>>> kswapd if there's no other reclaimable memory. >>> >>> I am sorry I still do not follow. What role do offline cgroups play. >>> Those are certainly not low mem protected because mem_cgroup_css_offline >>> will reset them to 0. >>> >> >> Oh, I meant "offline groups" to be "offline-business groups", memcgs >> refered to here are all "online state" from kernel's perspective. > > What is offline-business group? Please try to explain the actual problem > in much more details and do not let us guess. > Maybe I choosed the wrong word, let me rephase it, and here is an example. root 200GB / \ important(100GB) unimportant(100GB+DYNAMIC) / | \ / \ docker0 docker1... normal(100GB) oversold(DYNAMIC) / | \ / | \ j0 j1 ... w0 w1 ... "DYNAMIC" is controlled by the cluster job scheduler dynamically, it periodically samples the available system memory(/proc/meminfo "MemAvailable"), and use part of that to launch oversold jobs under some special conditions. When "oversold" is active, the whole system is put under heavy global memory pressure although memcgs are not. IOW "DYNAMIC" is primarily borrowed from "dockers" temporarily, oversold workers will be killed in a timely fashion if "dockers" needs their memory back suddenly which is rare. If kswapd doesn't reclaim low-protected memory configured among "important" dockers, memory allocations from dockers will trap into global direct reclaim constantly which harms their performance and response time. The inactive caches from dockers are allowed to be reclaimed although they are under low-protected(we used a simple MAX setting), we allow the inactive low-protected memory to be reclaimed immediately and asynchronously as long as there's no unprotected reclaimable memory. Its's also friendly to disk IO. For really latency-sensitive docker, memory.min is supposed to be used to guarantee its memory QoS. Thanks