From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751387AbdFASgg (ORCPT ); Thu, 1 Jun 2017 14:36:36 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:53478 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751238AbdFASgX (ORCPT ); Thu, 1 Jun 2017 14:36:23 -0400 Authentication-Results: kvack.org; dkim=none (message not signed) header.d=none;kvack.org; dmarc=none action=none header.from=fb.com; From: Roman Gushchin To: CC: Roman Gushchin , Tejun Heo , Johannes Weiner , Li Zefan , Michal Hocko , Vladimir Davydov , Tetsuo Handa , , , , Subject: [RFC PATCH v2 2/7] mm, oom: split oom_kill_process() and export __oom_kill_process() Date: Thu, 1 Jun 2017 19:35:10 +0100 Message-ID: <1496342115-3974-3-git-send-email-guro@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496342115-3974-1-git-send-email-guro@fb.com> References: <1496342115-3974-1-git-send-email-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c092:200::1:ebb3] X-ClientProxiedBy: DB6PR07CA0129.eurprd07.prod.outlook.com (10.170.219.22) To DM3PR15MB1081.namprd15.prod.outlook.com (10.166.160.135) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM3PR15MB1081: X-MS-Office365-Filtering-Correlation-Id: 2424106c-0ff3-4fb9-aebb-08d4a91d064b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:DM3PR15MB1081; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1081;3:5IzA03/PTvf197BklxH+hwRMJigeBen64ea3NN9w5J5eXmJ8KqJkwmRtsKLjbGkSCznR1eTqW1yDul+8C5xBL9NM+RiyGX/xYQISork18uZ5XxrHAu9c4Dp+GsoEYeO+ynCtcV4RO/X9Btjb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O2ZTl9gRbC45awgKS0LOFRdUjm1ogvumoGQo63MlRQhp4fM2wCLeJuXdHTe6ad0Z0PDY5pTvPuya5o9zzqMIPgMo6pT3HSkg67Ah+CcYSjLzsSmTb/H1Orh1/FsYZ7uMZjk2bFBIDbpLMOvyrYUID+D6wvvPVHs2d8Q0Iy9hQrq/gO8Vce+nu9xhMSMl8H7loU8l3k7S0Lsolknn+slG9hmzQpDtFcWvFqev4acRRLftuV/cycKf4/ZAcuyYrtv6g1AU/AySXMxlMSBt1ylD7i4vUr42F1ZOLd/QjkXBzjtIhpvUyXwASXiYIyOjaTi4ghBIU22Sm1547+dQx/SKE9bC81cQ/r+r+v8PuH4fWDtQHWs5/heE13Py6aN7CCBKEiwHDj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(50582790962513)(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6041248)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM3PR15MB1081;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM3PR15MB1081; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR15MB1081;4:R8O8qe6oUrl7OZLUCylGeSXdYvNhlD/3XBg4GEI3re?= =?us-ascii?Q?tAlKhxCzBWPv2htRUPfRRrhYwKxEgaEDtXBCGetdVp4Ch5ccqV5A1CW4ZgUP?= =?us-ascii?Q?rhJAXK0y8UoNe6nz2v144vBifHHeaVvazY/DafR+PSYwobH4hwEnfyPEu7B0?= =?us-asc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54OMDRqOR1G4hHv6eymwnI1C10lDa?= =?us-ascii?Q?n894ihD1jYpumsP3vF594PmuDrmnkVFpT+zhLvnpv4faV/lu4aZXmzmDSoWM?= =?us-ascii?Q?tDZGaVO4pANZxLSklmsUmSkZRTdbdjXEWBz+pLVOQTrSslVi4M2Cp+ziop2I?= =?us-ascii?Q?jBBJeWkn1jP9eYPfv18Z/s8fuaZVsaNGnmcsWiEfXaBQg5CaY7o+Sfp4xI1j?= =?us-ascii?Q?SQ3A5gGkde/fgG5FQ=3D?= X-Forefront-PRVS: 0325F6C77B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(39450400003)(39400400002)(39850400002)(39840400002)(39410400002)(33646002)(5003940100001)(2351001)(6666003)(6116002)(305945005)(2950100002)(6506006)(2361001)(86362001)(6486002)(6916009)(5660300001)(8676002)(6512007)(50466002)(42186005)(48376002)(7416002)(54906002)(53416004)(81166006)(76176999)(50986999)(38730400002)(25786009)(47776003)(2906002)(53936002)(50226002)(110136004)(575784001)(478600001)(7736002)(189998001)(36756003)(4326008)(217873001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM3PR15MB1081;H:castle.thefacebook.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR15MB1081;23:2facxOqQWso/lioCapslpvVDsb6zYRlui4woA8KbB?= =?us-ascii?Q?Xk9pEBiNwBxyA0UgaequjCnr/338IwFvJ2xy/Vzqj5DkDPhMhKIYAScdmJRT?= =?us-ascii?Q?GntNHRtX+ws31rrNVskM951EJRswEUrnxv0i2lAzXtixAvNVuda0mGKnYxCQ?= =?us-ascii?Q?MEjLKdYsqM9f2wJGIXMautmI7lsQ7O7/5kQYlOA35icNzB2zOH00Y6PnPw8o?= =?us-ascii?Q?tKnvVl0IeV5U+gyzveRvP6K7pG/wW5zeYKyKGSReQ0QfQJh8QNPKQLz+mYbw?= =?us-ascii?Q?qkCeXtwD6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dN2kc0iX/9RmlF/q4DXdoAerk8BMnuUCoKrCmMpevb9Jfu21sLh;24:JnlrwpF0sbATCfJvWKvaw+ItfEu8bKWmvUJpPyUVyXhXIZCdVsKbjeoE+EOTaW1JyMFRM7nJ+/D49jcI4myneQtZ2KfC9YPcK/ZtvZtZIXU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1081;7:JS5Xyysr7j5hSzOwedvDmrsmSgswEXFhmPo4GTyBqKQG7urjd8QtEd7OMmLDNJOBBNYWmhX5iM27Y8+HNPWcbS1VPmEJ8H+5Z9RcTWvPUXI8PN4Ek4mUJsoyFkZ3SG40Ti194IwptoNVVQ2Cwz90GD5Og6DMSntG3cxL8zBFhvPe5OxPdoBnUwhhHcqNjmKtajcAZEtuST21p6XZ9Kthx86KcyHGjMz/WUD+KPXbM1t+ZOugPRCQPTz2CwtOdy613Ha1ytl9n/qb1qm0D7dbl4ZlVHPsZGrvqDGROroS/+Ojvyzz5Lhw2N66nxb7+uWWxGoVUb32SlgL/cigN25GHg==;20:tvTmbHLJ9dqtUBSl4yRtKJiskW4Z4vWmGcsi00XyB7Lk1NF3fZ3QnfeXhdPjGj0fERhjYq/4ZKHB3/J68U39dt9KQ03SkSqn2s972R+LkJi7PIM8SuiyGfK9pnFJyJ5YmlUrA6qfOvAnY+zq/h6R52NvX8jeqQqtw4MlZ6Uia8w= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2017 18:35:47.3338 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB1081 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-01_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The oom_kill_process() function consists of two logical parts: a first one is responsible for considering task's children as a potential victim and some debug output. The second half is responsible for sending SIGKILL to all tasks sharing mm with the given victim. This commit splits the oom_kill_process() function and exports __oom_kill_process (second half) to reuse it from the memory cgroup code. Signed-off-by: Roman Gushchin Cc: Tejun Heo Cc: Johannes Weiner Cc: Li Zefan Cc: Michal Hocko Cc: Vladimir Davydov Cc: Tetsuo Handa Cc: kernel-team@fb.com Cc: cgroups@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org --- include/linux/oom.h | 2 + mm/oom_kill.c | 121 +++++++++++++++++++++++++++------------------------- 2 files changed, 66 insertions(+), 57 deletions(-) diff --git a/include/linux/oom.h b/include/linux/oom.h index 8a266e2..47d9495 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h @@ -79,6 +79,8 @@ extern void oom_killer_enable(void); extern struct task_struct *find_lock_task_mm(struct task_struct *p); +extern void __oom_kill_process(struct task_struct *victim); + /* sysctls */ extern int sysctl_oom_dump_tasks; extern int sysctl_oom_kill_allocating_task; diff --git a/mm/oom_kill.c b/mm/oom_kill.c index f8b0fb1..11b60a5 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -803,67 +803,12 @@ static bool task_will_free_mem(struct task_struct *task) return ret; } -static void oom_kill_process(struct oom_control *oc, const char *message) +void __oom_kill_process(struct task_struct *victim) { - struct task_struct *p = oc->chosen; - unsigned int points = oc->chosen_points; - struct task_struct *victim = p; - struct task_struct *child; - struct task_struct *t; + struct task_struct *p; struct mm_struct *mm; - unsigned int victim_points = 0; - static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL, - DEFAULT_RATELIMIT_BURST); bool can_oom_reap = true; - /* - * If the task is already exiting, don't alarm the sysadmin or kill - * its children or threads, just set TIF_MEMDIE so it can die quickly - */ - task_lock(p); - if (task_will_free_mem(p)) { - mark_oom_victim(p); - wake_oom_reaper(p); - task_unlock(p); - put_task_struct(p); - return; - } - task_unlock(p); - - if (__ratelimit(&oom_rs)) - dump_header(oc, p); - - pr_err("%s: Kill process %d (%s) score %u or sacrifice child\n", - message, task_pid_nr(p), p->comm, points); - - /* - * If any of p's children has a different mm and is eligible for kill, - * the one with the highest oom_badness() score is sacrificed for its - * parent. This attempts to lose the minimal amount of work done while - * still freeing memory. - */ - read_lock(&tasklist_lock); - for_each_thread(p, t) { - list_for_each_entry(child, &t->children, sibling) { - unsigned int child_points; - - if (process_shares_mm(child, p->mm)) - continue; - /* - * oom_badness() returns 0 if the thread is unkillable - */ - child_points = oom_badness(child, - oc->memcg, oc->nodemask, oc->totalpages); - if (child_points > victim_points) { - put_task_struct(victim); - victim = child; - victim_points = child_points; - get_task_struct(victim); - } - } - } - read_unlock(&tasklist_lock); - p = find_lock_task_mm(victim); if (!p) { put_task_struct(victim); @@ -930,6 +875,68 @@ static void oom_kill_process(struct oom_control *oc, const char *message) mmdrop(mm); put_task_struct(victim); } + +static void oom_kill_process(struct oom_control *oc, const char *message) +{ + struct task_struct *p = oc->chosen; + unsigned int points = oc->chosen_points; + struct task_struct *victim = p; + struct task_struct *child; + struct task_struct *t; + unsigned int victim_points = 0; + static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST); + + /* + * If the task is already exiting, don't alarm the sysadmin or kill + * its children or threads, just set TIF_MEMDIE so it can die quickly + */ + task_lock(p); + if (task_will_free_mem(p)) { + mark_oom_victim(p); + wake_oom_reaper(p); + task_unlock(p); + put_task_struct(p); + return; + } + task_unlock(p); + + if (__ratelimit(&oom_rs)) + dump_header(oc, p); + + pr_err("%s: Kill process %d (%s) score %u or sacrifice child\n", + message, task_pid_nr(p), p->comm, points); + + /* + * If any of p's children has a different mm and is eligible for kill, + * the one with the highest oom_badness() score is sacrificed for its + * parent. This attempts to lose the minimal amount of work done while + * still freeing memory. + */ + read_lock(&tasklist_lock); + for_each_thread(p, t) { + list_for_each_entry(child, &t->children, sibling) { + unsigned int child_points; + + if (process_shares_mm(child, p->mm)) + continue; + /* + * oom_badness() returns 0 if the thread is unkillable + */ + child_points = oom_badness(child, + oc->memcg, oc->nodemask, oc->totalpages); + if (child_points > victim_points) { + put_task_struct(victim); + victim = child; + victim_points = child_points; + get_task_struct(victim); + } + } + } + read_unlock(&tasklist_lock); + + __oom_kill_process(victim); +} #undef K /* -- 2.7.4