Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3258859imm; Sun, 3 Jun 2018 23:50:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLhFOUZzhmmAcHkwo1YPixgL/VrEfph2Q0j6b2vQQt0hlrXD6/pj8ZOkg7hobg/EGjufz2/ X-Received: by 2002:a63:7e08:: with SMTP id z8-v6mr16267428pgc.383.1528095026284; Sun, 03 Jun 2018 23:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528095026; cv=none; d=google.com; s=arc-20160816; b=PSdc58rjbZSa77Wb1oCbpkEcmToCA2Taa91BzuhxRtxUM5HQmcVJJ584zANu22SAH8 f2xqN965Vhoo8+NgXlhuffwS+rNa14q534n1DF+//EW+jW5qkC1foeVy+VTnyPD5Rgsh xhh7zJulnFZd+qhcDTTlNicsPcVIoDm5Yniok6D9ZDsFWWW1KObPzo09+NSlBzIqWi6Y B6yE+JETp9b0pqxbRYlHz+jAoe9cycMLHtKI3xVWA5ZQAHuckI/PcD0lqvwG3jKqXwtT 1hOyDLcVgXCAWRdt+0uMbmpkQLjHolbTk6cxZ0vmLgLugjehH7dfEVruSw+inBuq4nwK h3BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=YmSvNhRpsr3hwpKel4cdJLRRBLbHRA3gd8J3MDZpKcM=; b=WYI7GityyoSPwEP14Hiox9jEfbSHMYODWVe4NBl5IKJhBbYdcqsuN+y+K8C1vy/t2l Bp1T0EM7hM9fCFtEmbAUgBiqtwuXEcGgBIbYnjurjHIO/HYcA+usWrq/TlNBt34zoW+V 8ETFRUt44OP8CSlwvqRGJNeLAyARThoRrPVHfZCWWTlglo0yyGRJwFlmU49+PmdxdWsU oYxpTVW7dzCv7zwqRWsEgSj2DcbMjLBa2C9CubzRLJ3imEpSEk2bYIWo+x15Yu9jkEf1 ZM1S7PmwsPVcipVJms0zsMddfjJ7YhSn3t6bnzNdKve4rH05CXTqglEkgJd/2bB2lH+J xnRw== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13-v6si13699246pgb.610.2018.06.03.23.50.12; Sun, 03 Jun 2018 23:50:26 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751951AbeFDGsL (ORCPT + 99 others); Mon, 4 Jun 2018 02:48:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:53089 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbeFDGsK (ORCPT ); Mon, 4 Jun 2018 02:48:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7C08DAE01; Mon, 4 Jun 2018 06:48:09 +0000 (UTC) Date: Mon, 4 Jun 2018 08:48:07 +0200 From: Michal Hocko To: ufo19890607@gmail.com Cc: akpm@linux-foundation.org, rientjes@google.com, kirill.shutemov@linux.intel.com, aarcange@redhat.com, penguin-kernel@I-love.SAKURA.ne.jp, guro@fb.com, yang.s@alibaba-inc.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yuzhoujian Subject: Re: [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h Message-ID: <20180604064807.GD19202@dhcp22.suse.cz> References: <1527940734-35161-1-git-send-email-ufo19890607@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527940734-35161-1-git-send-email-ufo19890607@gmail.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 02-06-18 19:58:51, ufo19890607@gmail.com wrote: > From: yuzhoujian > > This patch will make some preparation for the follow-up patch: Refactor > part of the oom report in dump_header. It puts enum oom_constraint in > memcontrol.h and adds an array of const char for each constraint. I do not get why you separate this specific part out. oom_constraint_text is not used in the patch. It is almost always preferable to have a user of newly added functionality. > > Signed-off-by: yuzhoujian > --- > include/linux/memcontrol.h | 14 ++++++++++++++ > mm/oom_kill.c | 7 ------- > 2 files changed, 14 insertions(+), 7 deletions(-) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index d99b71bc2c66..57311b6c4d67 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -62,6 +62,20 @@ struct mem_cgroup_reclaim_cookie { > unsigned int generation; > }; > > +enum oom_constraint { > + CONSTRAINT_NONE, > + CONSTRAINT_CPUSET, > + CONSTRAINT_MEMORY_POLICY, > + CONSTRAINT_MEMCG, > +}; > + > +static const char * const oom_constraint_text[] = { > + [CONSTRAINT_NONE] = "CONSTRAINT_NONE", > + [CONSTRAINT_CPUSET] = "CONSTRAINT_CPUSET", > + [CONSTRAINT_MEMORY_POLICY] = "CONSTRAINT_MEMORY_POLICY", > + [CONSTRAINT_MEMCG] = "CONSTRAINT_MEMCG", > +}; > + > #ifdef CONFIG_MEMCG > > #define MEM_CGROUP_ID_SHIFT 16 > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 8ba6cb88cf58..c806cd656af6 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -237,13 +237,6 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg, > return points > 0 ? points : 1; > } > > -enum oom_constraint { > - CONSTRAINT_NONE, > - CONSTRAINT_CPUSET, > - CONSTRAINT_MEMORY_POLICY, > - CONSTRAINT_MEMCG, > -}; > - > /* > * Determine the type of allocation constraint. > */ > -- > 2.14.1 -- Michal Hocko SUSE Labs