Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1607412imm; Sat, 2 Jun 2018 05:00:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKOvSl+CG0+8HHHbLjF879brGaMJY4lH42x89L8/pQE9a5+jIwPUWwpgTXqU7NtMy21dCE3 X-Received: by 2002:a17:902:bc4c:: with SMTP id t12-v6mr14839981plz.177.1527940823943; Sat, 02 Jun 2018 05:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527940823; cv=none; d=google.com; s=arc-20160816; b=YEDODTfZZhyI0RmyZ9+bd9FE8VjQBLm1h9FQbKTj1iT8lfbFOK0GkDLHj4iHON6v2D leRW4bgfLtn5YeMt96+n4U7J+vJDl5ZitXsTfoZJ6/d/TVifB92PgENCSJlH2rBbq2bx vMBE+6LSj+UBRxTpx+r7XoLL4KOOQzzsz0PKCxb0vy4AHDBhh+7eKSVDgL+Aquo5Wi+y hdz/FOoZzX3o9wi+BQlyyDK/bKwIHtjGkoDrSpIeDjlKeWcMTcrlUmVZa78smLi4F13L sZQjvOAFoMGY92eTnBjOWRyUNboElS9JTz6rWUVLN9qrg9Yx6DmekGLEuC5BTryOgDXV Mb+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=tVwHDyE4u8qGm3FbAMqQA8kY26gjDGUXcIX4LM/uoP4=; b=vftvS5xhRQX2TYiCsaIXxfx5ZnvsVewvmK//nxM1krUjch9/+4Yc8+8sK3k9FQlU/O Zq3jztbAkFCOF4G1ItqG62+HPmrribcsRnHS3fV/eivJZaU1HODJAMDiD1UFAUzNk/F6 0SPCmBAVjUcdEnJVxC34DeOXz2tzULAwtQKPQSDu03MOVgbyiIp+MhWVf0cLJieAANzw zJfuVn/keEPhG205bd03o7oNdYXuwAwTTJTsm+DK2ofqzi7cuqUsxsMJeVcaQfuAP0l9 Ix3d0OGdUymAncKZ550lIOov32yEdNXNLZLQg7Rsv5HLF+JYQFb3osnL6bl95DJ4IiZ4 g3VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dUwBBefA; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4-v6si41508613plp.580.2018.06.02.05.00.09; Sat, 02 Jun 2018 05:00:23 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dUwBBefA; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751758AbeFBL73 (ORCPT + 99 others); Sat, 2 Jun 2018 07:59:29 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:45367 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750886AbeFBL71 (ORCPT ); Sat, 2 Jun 2018 07:59:27 -0400 Received: by mail-pf0-f195.google.com with SMTP id a22-v6so541033pfo.12 for ; Sat, 02 Jun 2018 04:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=tVwHDyE4u8qGm3FbAMqQA8kY26gjDGUXcIX4LM/uoP4=; b=dUwBBefAmirOkAGtX1VwUWn8lsJRNqLnQG3u3i/XXxhXXp43zYszlsq7InZhwvluGC a9pmKOziuSaO5/83AG6HyfQNvW+Oxj8EhRvKSK6D3B9mjQ7HIswinDHex3dPM17kKfMD SrnjZEkSE9t+bq91pcr03+kJH8rocER80q+kxRrsBcisfNOV93FDrfKOMZQTGY9WkECX CKG9bZoQM1HDZctOtDEIo/j10VXM82Q8QnMS+DHy/020zfq6mC/6GYcBaldxbhThirUa rYQilABpZtXIjADmhwvNTZaD7U0Sjge3LcKZDHEEKyZrk18guGnAyUZuZj3U+JuZnqYB 8/kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tVwHDyE4u8qGm3FbAMqQA8kY26gjDGUXcIX4LM/uoP4=; b=YjgcnwnmDY8j/DGijpja8X/lD2fbDrO7OXlQDOgapI3IsZYR8fjcWdIL55XpTwI1Hn HZY6aLwLfLhf6Fglx3VY0L0fkCE078lRDcGBphdeJfpS0EwVyAFwSXadfW+xXn63VT3k ixJ6RyrWW5iCFQC0OT625OPHPNJ/WloaYQE/pC8I3TVf0wyP3AzqgWkpFRDwYfBqKSXJ COrECt9WkF/MB5mu2ikXV0/9ng9wsIVTse7y+r2z7YXsWwR0y8+YEk7M/D6iICr9c4RU LCNmwkwkmP9j+KH2UKn2pV7L6PqEbRSydWFVoNTu0PwqiAxcHiRmTOGOwSw86b8jGTZl Eo7g== X-Gm-Message-State: ALKqPwfa+sC7bEIv1TAs9pSlJ4shC1iAa/hrjeJ47OFPaUDV93zt4can S83ntu6qu8lskGS394Zelag= X-Received: by 2002:a63:b407:: with SMTP id s7-v6mr8740939pgf.334.1527940767381; Sat, 02 Jun 2018 04:59:27 -0700 (PDT) Received: from dest.didichuxing.com ([52.229.160.192]) by smtp.gmail.com with ESMTPSA id c83-v6sm84723543pfc.111.2018.06.02.04.59.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 04:59:26 -0700 (PDT) From: ufo19890607@gmail.com To: akpm@linux-foundation.org, mhocko@suse.com, 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 Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, yuzhoujian Subject: [PATCH v7 1/2] Add an array of const char and enum oom_constraint in memcontrol.h Date: Sat, 2 Jun 2018 19:58:51 +0800 Message-Id: <1527940734-35161-1-git-send-email-ufo19890607@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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