Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7074899imu; Mon, 3 Dec 2018 07:22:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/UugxN1hC5NDSnISta0Bd3ytvqozAfnH5sHqgyl9hhwCCecoGoKFprCi/ddhwOcGzKnRpcZ X-Received: by 2002:a17:902:7443:: with SMTP id e3mr16364999plt.304.1543850521988; Mon, 03 Dec 2018 07:22:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543850521; cv=none; d=google.com; s=arc-20160816; b=ZDqZCP+hRMETEW1kR+DGuY2u++O4GnKXh01CDzp6qRRs1eTKjxHM1JLS7ojGgc9udv 5NakFm1nXt6sCxT0R/FLF/LnG6GeFTHYLPnMudl63nT2e3hpOlAQHdpM4tIY0fBU0Geg u3lHOFud35nmh9naLpuwvrde+Gz8uTHbQEFsGtjSJrj17Qdhr5HqAKjYHiDkW0+T6G8A I/cFCgRQgymLAoc8E2QbfvM41e87mJdF//MmG0+dGsEARs5Yc5dxQOTODb9pCjMhiBn4 5K3/dZZpD8R0rJnoqxMZsp2fJXrkNahipymxLrOlLi3xA/3RLXxsA1kona60W8wTWzO+ J75g== 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=hbVzC648IgwC+OrLwHx7xbf3c0NMDu2RCv3tpmwbGFY=; b=ev4lYQ8+NvBq3pPVzISt8r6Zm2gKaS509yCCzZ7g8d1kvC6l9VN7Yj0yZHa7pf2uv2 TrWZsqlQ6EA3a5v17PMSaDpXmr8IripSIfHo8feUwqkZpZ9muIYvQdBcXa4LXmKmJPHr GUxjJ4AdeMOR4CCkZ/jsLwnO8TUN6Bk/CwKua949HVd98lkgSICof61sYxYmQXyUFM7u iRZgArVNM0/j5rJVzJFmUxjq4z3icVkfThZkTd7gzcUK6AiO9VqMoACgyHas1MQMPewP R3pG8Df1zvYlHih+1qi3wk7Q+j6B6c7A3NKGJSLYDzvUQ7wLIVVqY1tKTg7++P5FKbBt gbEA== 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 f23si11218512pgv.431.2018.12.03.07.21.46; Mon, 03 Dec 2018 07:22:01 -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 S1726676AbeLCPUi (ORCPT + 99 others); Mon, 3 Dec 2018 10:20:38 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:56728 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726549AbeLCPUi (ORCPT ); Mon, 3 Dec 2018 10:20:38 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R401e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=xlpang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TElCRpQ_1543850431; Received: from xunleideMacBook-Pro.local(mailfrom:xlpang@linux.alibaba.com fp:SMTPD_---0TElCRpQ_1543850431) by smtp.aliyun-inc.com(127.0.0.1); Mon, 03 Dec 2018 23:20:32 +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> From: Xunlei Pang Message-ID: <54a3f0a6-6e7d-c620-97f2-ac567c057bc2@linux.alibaba.com> Date: Mon, 3 Dec 2018 23:20:31 +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: <20181203115646.GP31738@dhcp22.suse.cz> Content-Type: text/plain; charset=gbk 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/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. > >> >> Signed-off-by: Xunlei Pang >> --- >> mm/vmscan.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/mm/vmscan.c b/mm/vmscan.c >> index 62ac0c488624..3d412eb91f73 100644 >> --- a/mm/vmscan.c >> +++ b/mm/vmscan.c >> @@ -3531,6 +3531,7 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx) >> >> count_vm_event(PAGEOUTRUN); >> >> +retry: >> do { >> unsigned long nr_reclaimed = sc.nr_reclaimed; >> bool raise_priority = true; >> @@ -3622,6 +3623,13 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx) >> sc.priority--; >> } while (sc.priority >= 1); >> >> + if (!sc.nr_reclaimed && sc.memcg_low_skipped) { >> + sc.priority = DEF_PRIORITY; >> + sc.memcg_low_reclaim = 1; >> + sc.memcg_low_skipped = 0; >> + goto retry; >> + } >> + >> if (!sc.nr_reclaimed) >> pgdat->kswapd_failures++; >> >> -- >> 2.13.5 (Apple Git-94) >> >