Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5140739yba; Wed, 10 Apr 2019 12:14:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYPhPktNCfTUSJcaBYIdm/YbxRlA5Yu3EIy40QTWZU51gBS2G6/IHWrm/rgNgYIHT/Ic+g X-Received: by 2002:a62:e501:: with SMTP id n1mr21911743pff.17.1554923699884; Wed, 10 Apr 2019 12:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554923699; cv=none; d=google.com; s=arc-20160816; b=qYcVRPXiHuc4LGpfIo1SRb0toV6ZV2GMLu9AA+3Ha8NKewH6yTvnNvV3UJGQKGaObx EWLAEBttRzr+kXKfim1SqAaTJ/4VxHEojuI8RVQOD8cf+eCyV2I0s1k0HkvFOkEKb/EI AoMM4CUO9eCO0I7ERi/KQI3+E2yJmmnTHzdocJtWpIedQVA+YVAwfAHSWGUu1HOdkoO/ TaR1G3tVMWk/yqWER5X3EOzOrDkLE9TxdwfaP4Xh+MlnZ4DxRONyng14gCPiyfkSI4+1 Uw4BSDmQY7Tp7wqonISDGATJnzRYFOt/Kd4ovfCRiKjoqCi6uuD58KF5sb95jYrY2XqP XAhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=DBnRKe3YvnMxKXTvsMS+Ndxzgp3NvLrWe0H5kgMgy5M=; b=Pg7DRPsk8SW8H5Nh6tjhigtLGWnKXo59CaqAjAOhpy82Lhi+NgK4LHQ73ru0v6hoE6 w+K8llPeOmVr5pUPujm0zYINW8+xiSUChOWPQdvILBwktF4W3vBzF8BIO+d82b2OhHaK zRw3hiUnJzwwJGZpn43WLV+udtudkCb1Ik3jUa0Q2KTQdvUSg9r0S2nYpQ6G0j2VZd9c ZwkznTFXxVabgjA8wDxaTsjpXm7EMgqBa+ETouYs6KDTRvvJ7Zp1uH0lHjZAf7cyHF8H mu99P8kKCvwvYuwoBEYqrZoQEwRoHX650qfFOq5ys5wGaNgUV0B0F84frkz8pAhC2T97 Sg8w== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h66si8936663pgc.418.2019.04.10.12.14.43; Wed, 10 Apr 2019 12:14:59 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726638AbfDJTOD (ORCPT + 99 others); Wed, 10 Apr 2019 15:14:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53546 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726615AbfDJTN7 (ORCPT ); Wed, 10 Apr 2019 15:13:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E7063086225; Wed, 10 Apr 2019 19:13:59 +0000 (UTC) Received: from llong.com (ovpn-120-189.rdu2.redhat.com [10.10.120.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F2FD600CC; Wed, 10 Apr 2019 19:13:57 +0000 (UTC) From: Waiman Long To: Tejun Heo , Li Zefan , Johannes Weiner , Jonathan Corbet , Michal Hocko , Vladimir Davydov Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Roman Gushchin , Shakeel Butt , Kirill Tkhai , Aaron Lu , Waiman Long Subject: [RFC PATCH 2/2] mm/memcontrol: Add a new MEMCG_SUBSET_HIGH event Date: Wed, 10 Apr 2019 15:13:21 -0400 Message-Id: <20190410191321.9527-3-longman@redhat.com> In-Reply-To: <20190410191321.9527-1-longman@redhat.com> References: <20190410191321.9527-1-longman@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 10 Apr 2019 19:13:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A new MEMCG_SUBSET_HIGH event is added to record the number of times subset.high value is exceeded. Signed-off-by: Waiman Long --- include/linux/memcontrol.h | 1 + mm/memcontrol.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 1baf3e4a9eeb..4498db61507a 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -52,6 +52,7 @@ enum memcg_memory_event { MEMCG_LOW, MEMCG_HIGH, MEMCG_MAX, + MEMCG_SUBSET_HIGH, MEMCG_OOM, MEMCG_OOM_KILL, MEMCG_SWAP_MAX, diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 7e52adea60d9..feba8b9c55b3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2150,8 +2150,10 @@ static void reclaim_high(struct mem_cgroup *memcg, /* * Try memory reclaim if subset_high is exceeded. */ - if (mtype && (memcg_page_state(memcg, mtype) > memcg->subset_high)) + if (mtype && (memcg_page_state(memcg, mtype) > memcg->subset_high)) { + memcg_memory_event(memcg, MEMCG_SUBSET_HIGH); try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, true); + } do { if (page_counter_read(&memcg->memory) <= memcg->high) @@ -5603,6 +5605,8 @@ static int memory_events_show(struct seq_file *m, void *v) atomic_long_read(&memcg->memory_events[MEMCG_HIGH])); seq_printf(m, "max %lu\n", atomic_long_read(&memcg->memory_events[MEMCG_MAX])); + seq_printf(m, "subset_high %lu\n", + atomic_long_read(&memcg->memory_events[MEMCG_SUBSET_HIGH])); seq_printf(m, "oom %lu\n", atomic_long_read(&memcg->memory_events[MEMCG_OOM])); seq_printf(m, "oom_kill %lu\n", -- 2.18.1