From patchwork Sat Jun 2 11:58:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?56a56Iif6ZSu?= X-Patchwork-Id: 10444775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C5D46602BD for ; Sat, 2 Jun 2018 11:59:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B416428A67 for ; Sat, 2 Jun 2018 11:59:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A739428A7C; Sat, 2 Jun 2018 11:59:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8406A28A67 for ; Sat, 2 Jun 2018 11:59:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 705156B0005; Sat, 2 Jun 2018 07:59:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6B6306B0006; Sat, 2 Jun 2018 07:59:29 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A48F6B0007; Sat, 2 Jun 2018 07:59:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 1791F6B0005 for ; Sat, 2 Jun 2018 07:59:29 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id y26-v6so6392446pfn.14 for ; Sat, 02 Jun 2018 04:59:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=tVwHDyE4u8qGm3FbAMqQA8kY26gjDGUXcIX4LM/uoP4=; b=BbqBDqP/41fG5qqvkE4BbbVME3C0ptXxmtMa7c2DZgqW20swS9gNS1C3To7jO4+WP/ nQlH6U45UOI6gGQ2gigFgrjblK4z8xkJ7jingXE+kTPqUdyxkuDNsZmDywNTrh/J+6MC i9EgxVNemtL2AbPLGgmjLIe0KViz4aXikN2e9ikBxD6txlOaShyjQ/V9QZw+c/6hwyVx WRXqe+chYTu5/EM+ILQauXjqUGoRa8+V2bHxm0DDokd7wUqlfPken6PFopKZSOSfVA6D OcziF6icQQAScVFtIO3Agkbye5DtRdcilm2bprbPcJbGRsopLYOSLNuQ0dXxGCwgUIDM 4OsA== X-Gm-Message-State: ALKqPwcys08ctXmxDG8VMRhboVvKSpLjRvZ7K9/vHsyRgDm7u+TX2sy0 qtCPYCQUQgc7ottlxwCAcGgOyfepekby1dy5FODSfVE1AtElvx8ds8+3bgSa8nh+y/g+vzdkSfT QipSe6oNNc/15IhaZnVrmNpxCD//kCGClKllwc/WZD5ZtFFZshmQWODQsiWjNNWeQyLwsOAAfwO J7xA5ujsOvbi/ErQYQX14pxzf5xBQVxZCa/dmVGpL90LRXXjJ3vkUTxMZa1iQQQIDUL8GS8oWq9 b6mf4FPWZON8VEQbedg+K++X9MS5bR8fYAkKiacTM61pAqYAev8jXc2F3SDouam/8gzFVaMbbcc 7id3R3r4wumCxPIs2/fxDLu8BUtL2RtV2b7qnXXdmHa4OsU3liEwb5VAQmyp9SPHM1cUWjYl3Dh B X-Received: by 2002:a62:d653:: with SMTP id r80-v6mr14400329pfg.54.1527940768762; Sat, 02 Jun 2018 04:59:28 -0700 (PDT) X-Received: by 2002:a62:d653:: with SMTP id r80-v6mr14400282pfg.54.1527940767652; Sat, 02 Jun 2018 04:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527940767; cv=none; d=google.com; s=arc-20160816; b=kpGnHNxZwqJw/+pqu9BcIzK3Ak3eiYzznorG67Y/4Sa5Scm39kf1S+e9BvagiBPagY B0vUTy6dkBrVA9t8YyNHozwWQNVFoiVTDV0lIt2XsckrIEPjZ2V8kFUFSVhh1zXKVgvR ZqPf4KcLThev4FbFD1K/is66m/PZjVly+AjvDNoicZKS8Tme9fdt03jeEvesUAexMcFU F7yUL5GKAvk5Sa2vXeXoq3ldAMmFKE7XnH2bjtLFIPIzdt4DLCzFxR0RuygSHwCDQNPt LBActBi3c3OEpSl/MUswdkGYuuTcdnUW5ZqY/RdAOAbGRgiFfNxoqm+I5itxk1gqO4K5 yp8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=tVwHDyE4u8qGm3FbAMqQA8kY26gjDGUXcIX4LM/uoP4=; b=TNhyu08SqQ320dgCKZHr9eT39QTDDhcV57T76zW9gS3i7l+nW56ttl/j6j8qI73BFR 7DwCzA6TqOymQDpe1MITO3/yWRGE8q8Dl38Ale3QXH8ubbAVMuVb0gE2jDy87jw8EMJz YMWSKskVrk+SwiK+eUsZvCMMrw6v8hH95Fk6+/Op5sKwltPa+AFgLr8+LGwGao98msft rb8jM+0kIUX8IPMnyDnMh10mhTP12/zTadJWJxD9pq7AHmP1xQJofT2xWZFsKGmBtwK7 x8fySFGC1oUGLn2nVy0bNs49VT0rhBujXTjDoqFmEKV3zqpBvt/MptFnFW6N8a0znTQg W7qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dUwBBefA; spf=pass (google.com: domain of ufo19890607@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=ufo19890607@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c19-v6sor1116022pgn.172.2018.06.02.04.59.27 for (Google Transport Security); Sat, 02 Jun 2018 04:59:27 -0700 (PDT) Received-SPF: pass (google.com: domain of ufo19890607@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dUwBBefA; spf=pass (google.com: domain of ufo19890607@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=ufo19890607@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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-Smtp-Source: ADUXVKINCyq/IUvYnbcnVwirv+Qj2ZVG9fEgsGdqKMUUwfrRf9gERuLRyJ7D2iJ31R1gDEFa+aXYuQ== 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 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: X-Virus-Scanned: ClamAV using ClamSMTP 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. */