From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E6A5C3A5A9 for ; Mon, 4 May 2020 07:59:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4D42F20746 for ; Mon, 4 May 2020 07:59:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D42F20746 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6CFD18E0006; Mon, 4 May 2020 03:59:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 658CA8E0001; Mon, 4 May 2020 03:59:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 521208E0006; Mon, 4 May 2020 03:59:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 358DF8E0001 for ; Mon, 4 May 2020 03:59:06 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E22BB4995E7 for ; Mon, 4 May 2020 07:59:05 +0000 (UTC) X-FDA: 76778285850.26.lead32_1533ef5cb152c X-HE-Tag: lead32_1533ef5cb152c X-Filterd-Recvd-Size: 5269 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 07:59:05 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id v8so14902884wma.0 for ; Mon, 04 May 2020 00:59:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=T/aLYIJ/NJZGbxi+uQunQWBLLMQKIdzXnVVy1xODpho=; b=I5VYky+Sjrb1VgB5OCF8LueaHsUTB14zeLiAb2y0x6iWOdD3Se5cihnZWrx7lHky0L hFdfo5tYKFejXIwEUbGRQ8DjB6yVs5PJNju6YVB/8cpESB8LPRmsura0m3/uq0YzM8tk UVnxtsqISJqq14AZGnLyirSrGBnIrsj0Bqvajk0YDwa2wS5dlorNMMupq3KUx7bjE5D1 qGYmMrdUZKwYAxqCPsFHa5blu+3ot+Pe6kCJngo86F+3uHLve28jB38gMDU01/fNGqGk EMMNUnq/RkqBIj8nFlI7SaNNppAtSJcag3QPRo+I0vC6+uXMsW6XMrqYf2ZKn6YSlmSk cPdQ== X-Gm-Message-State: AGi0PuaOXOfB85jyWmSqp758aXNX9L/OdsoDtyj/5+MDvYcuvDmxxhXF Kny5ClkWDGN7o1Nj2T6z4KY= X-Google-Smtp-Source: APiQypLO3V1wIY/2o3PxLRstxf0LdTtRCtKashyqhInem15RlNSi3aHfBnQ5TbrYCtBti2wExgZfWA== X-Received: by 2002:a1c:2042:: with SMTP id g63mr13110060wmg.70.1588579144495; Mon, 04 May 2020 00:59:04 -0700 (PDT) Received: from localhost (ip-37-188-183-9.eurotel.cz. [37.188.183.9]) by smtp.gmail.com with ESMTPSA id n6sm11812943wmc.28.2020.05.04.00.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 00:59:03 -0700 (PDT) Date: Mon, 4 May 2020 09:59:02 +0200 From: Michal Hocko To: Yafang Shao Cc: akpm@linux-foundation.org, shakeelb@google.com, hannes@cmpxchg.org, guro@fb.com, gthelen@google.com, linux-mm@kvack.org Subject: Re: [PATCH v2 1/2] mm, memcg: rename mem_cgroup_out_of_memory() Message-ID: <20200504075902.GH22838@dhcp22.suse.cz> References: <20200504042621.10334-1-laoar.shao@gmail.com> <20200504042621.10334-2-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200504042621.10334-2-laoar.shao@gmail.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon 04-05-20 00:26:20, Yafang Shao wrote: > Rename mem_cgroup_out_of_memory() to mem_cgroup_oom_kill() to indicate > that this function is used to try to kill a process. > With this change it will cooperate better with the oom events. > function memcg event > mem_cgroup_oom() oom > mem_cgroup_oom_kill() oom_kill > > Signed-off-by: Yafang Shao > Reviewed-by: Shakeel Butt > Cc: Johannes Weiner > Cc: Michal Hocko > Cc: Roman Gushchin > Cc: Greg Thelen Well, I do not have a strong opinion on this. I believe the idea behind the naming was that this is a memcg counterpart for out_of_memory. So to be honest I do not consider this an improvement. > --- > mm/memcontrol.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 5beea03dd58a..985edce98491 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1570,7 +1570,7 @@ unsigned long mem_cgroup_size(struct mem_cgroup *memcg) > return page_counter_read(&memcg->memory); > } > > -static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, > +static bool mem_cgroup_oom_kill(struct mem_cgroup *memcg, gfp_t gfp_mask, > int order) > { > struct oom_control oc = { > @@ -1799,7 +1799,7 @@ static enum oom_status mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int > * relying on the oom victim to make a forward progress and we can > * invoke the oom killer here. > * > - * Please note that mem_cgroup_out_of_memory might fail to find a > + * Please note that mem_cgroup_oom_kill might fail to find a > * victim and then we have to bail out from the charge path. > */ > if (memcg->oom_kill_disable) { > @@ -1821,7 +1821,7 @@ static enum oom_status mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int > mem_cgroup_oom_notify(memcg); > > mem_cgroup_unmark_under_oom(memcg); > - if (mem_cgroup_out_of_memory(memcg, mask, order)) > + if (mem_cgroup_oom_kill(memcg, mask, order)) > ret = OOM_SUCCESS; > else > ret = OOM_FAILED; > @@ -1879,7 +1879,7 @@ bool mem_cgroup_oom_synchronize(bool handle) > if (locked && !memcg->oom_kill_disable) { > mem_cgroup_unmark_under_oom(memcg); > finish_wait(&memcg_oom_waitq, &owait.wait); > - mem_cgroup_out_of_memory(memcg, current->memcg_oom_gfp_mask, > + mem_cgroup_oom_kill(memcg, current->memcg_oom_gfp_mask, > current->memcg_oom_order); > } else { > schedule(); > @@ -6102,7 +6102,7 @@ static ssize_t memory_max_write(struct kernfs_open_file *of, > } > > memcg_memory_event(memcg, MEMCG_OOM); > - if (!mem_cgroup_out_of_memory(memcg, GFP_KERNEL, 0)) > + if (!mem_cgroup_oom_kill(memcg, GFP_KERNEL, 0)) > break; > } > > -- > 2.18.2 -- Michal Hocko SUSE Labs