Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1609438imm; Sat, 2 Jun 2018 05:02:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL6/4vOb/66ihVc2neibSpsxLZy0a9rSnS/uCqT66SsXTZJKBaTtyZIUTaj6OqmYGJvLUzQ X-Received: by 2002:a63:6bc7:: with SMTP id g190-v6mr11680833pgc.230.1527940934991; Sat, 02 Jun 2018 05:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527940934; cv=none; d=google.com; s=arc-20160816; b=cYBCd8TmbGluqPCVHEkH/G0PN5VYAjoi23dG1teavvbzD5uZD2+d4D4vO+cGd9Mq05 7ssYYEeA628rFZyGZZK/znWX12yog6Fk9W3f+JmG8sR7adQXjT85ogTa0NfhGS0+b8RL 9vBByK6UK6Reqdi0kfgV1qZ+NGX5e68XRFv19GLcOHSkA3KdpUD5HwietCWE5n+iD1gD wyQASUFDCBetgUVIKsH3gViF69xk4KJFb5TpaCwjdUbXsiSAGBSWPx/azH6ylCFxOybg bh0CW+DcHdYDD5TQfOfkhOThDHM1xbHhpWedkTGf4v7/veygEKwA2fOHsEYQogYI7wcf 5rMw== 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:dkim-signature:arc-authentication-results; bh=tVwHDyE4u8qGm3FbAMqQA8kY26gjDGUXcIX4LM/uoP4=; b=j3sKfvJhTwD3ttOhzhUvyG8vHe5z+MvRVz8JiPDsZoobmnZjPDXat/POAbfiZg3O+4 gQ1BsStNs/Z2TMHsUE/+w51CMiMIYYLkL/V13c84n5DJgHUArgXEGEJ9FKSKlpKClaWD g+lmKrmGjWsjV2wPMOFcV2Ra0QHHa4V2hbZXlR0HtwDegqPuL75kqqukUbaCgBa8VFgb ypM8f7ZXrYw7N4TQuz1J+mQexIcJ5eP5o8+MQMzoxgtkHBY5nPSooDVDVDY+wXL2vFa+ yi/cM+uRMTQnKdDZEta11Fff6ePjhC+bYO7Bbl++/A46gtHhIVULuxRkExFlVBmFri45 HP+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NkvWcjjF; 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 o26-v6si3230682pge.307.2018.06.02.05.02.00; Sat, 02 Jun 2018 05:02:14 -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=NkvWcjjF; 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 S1751913AbeFBMAE (ORCPT + 99 others); Sat, 2 Jun 2018 08:00:04 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36094 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751781AbeFBL7j (ORCPT ); Sat, 2 Jun 2018 07:59:39 -0400 Received: by mail-pg0-f66.google.com with SMTP id m5-v6so8034588pgd.3 for ; Sat, 02 Jun 2018 04:59:39 -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:in-reply-to:references; bh=tVwHDyE4u8qGm3FbAMqQA8kY26gjDGUXcIX4LM/uoP4=; b=NkvWcjjFPGLvSmIosm4GibhiPoyjeRZoWG61lXyUeBxoMguYWO9VGJdDBjE74fU0Lt s2PziUEGrvX77kZEvJiTxXMhm+K745nxnlKTFgcJI8UUYtb0GmMOCPf9qemuOpEQJ6h6 BSdCQQbUzzmiHHdzpkCy8vP+jYnbt9Q18o9rSV3o8vSoPJXbnVRBrxcgL9gjRCLjTFjR 2t5S5GoxfG3tO+yNNEsmC75hHgW7FkkkCje7PmalvJXkmMPkG9ckzko/K7mzOp7bVju6 6wkhmteW2hON0dY7qasma6LazhwtC3i2nZuFQdKPj3S1GYhhTuBW30/a/J5Om3V6wexD lnog== 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:in-reply-to :references; bh=tVwHDyE4u8qGm3FbAMqQA8kY26gjDGUXcIX4LM/uoP4=; b=PFZAD2r7f4Nn69+Wlty+1HGWE5/I9fddADoMTD+au5YnSRbPcIw2rNePZxD49WtpL4 dV6yqzHQ8RXV9FeGLEqJmEYeN29nwXMyAefvZU0ap3d3GgpDClD9Ct7S+5xTt916v3Wc BzUcqcLreLk75NWCMRYl6xRwOU1Ko4hAk9TA8mfWXa+yQhke3dMMK2C642NlFslWse1D kUiW89n97CKKNIJhBSV/0D3rce0TZUsjONwE1DwvQLGTRjjz6uqfIBNDVyz/hsUMl/cJ lRG0ZFkCKl/IH8hsPtef6H7vt+oUcuLHUSpUWCANzozmWs5dyj43STqzQ8DEUFhGaQMQ FxfA== X-Gm-Message-State: ALKqPwfhFGmY9PobFSXaDaI6Suq+PXAfLVUwztZvoIZkc3ex03fEdwNe qF77oC24YLM6uV+s407O3mE= X-Received: by 2002:a63:3348:: with SMTP id z69-v6mr8215732pgz.171.1527940779179; Sat, 02 Jun 2018 04:59:39 -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.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 04:59:38 -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:53 +0800 Message-Id: <1527940734-35161-3-git-send-email-ufo19890607@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1527940734-35161-1-git-send-email-ufo19890607@gmail.com> References: <1527940734-35161-1-git-send-email-ufo19890607@gmail.com> 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