From patchwork Fri Sep 7 21:34:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jay Kamat X-Patchwork-Id: 10592555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D56E6CB for ; Fri, 7 Sep 2018 21:35:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DC682B6BD for ; Fri, 7 Sep 2018 21:35:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31D252B6C5; Fri, 7 Sep 2018 21:35:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E4A22B6BD for ; Fri, 7 Sep 2018 21:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729519AbeIHCR4 (ORCPT ); Fri, 7 Sep 2018 22:17:56 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:45088 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728060AbeIHCRz (ORCPT ); Fri, 7 Sep 2018 22:17:55 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w87LYmWZ020102; Fri, 7 Sep 2018 14:35:00 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=9gr3Rbo11zoyW0Xs3bAyGP8QsHlFdH6LdNsN1G9NhRM=; b=RSBXlDy+s2ICqJD//aqnVRzmIDB8NNboZAgHlRY9r1uCcL87MCjq/e0BzAaspQf5vZhC yOW5VBw5uzuMfumi/o1QZVbJbefof68Zu/kPN/8ex1S9g856IiunuYt1AAjHoUxggoRD g5SWXOjoykxeQObq/YNiQ6SJR/M/QVFr8DA= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2mc1b3g072-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 07 Sep 2018 14:35:00 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.24) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 7 Sep 2018 17:34:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9gr3Rbo11zoyW0Xs3bAyGP8QsHlFdH6LdNsN1G9NhRM=; b=YhpWIYBt5zJ5bVkanhwivdSN2qOTagXkmBm0ePMy7C5sJfuSdwZSEgISJiShcl9/hJ3+RWJdTcWWEyDF81obRuR6gMoLOZ2MI3QXtjc9uOsRwldnkj+GM7j1R+ORv4GfxdtUmgUtNRIhkVxDDScgFJiNns2JmpudFmuMB8Kz6uY= Received: from vall.thefacebook.com (2620:10d:c090:200::7:36ec) by MWHPR15MB1230.namprd15.prod.outlook.com (2603:10b6:320:23::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.15; Fri, 7 Sep 2018 21:34:55 +0000 From: To: CC: , Roman Gushchin , Tejun Heo , , , , Subject: [PATCH v3 1/2] Fix cg_read_strcmp() Date: Fri, 7 Sep 2018 14:34:04 -0700 Message-ID: <20180907213405.31574-2-jgkamat@fb.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907213405.31574-1-jgkamat@fb.com> References: <20180907164924.13789-1-jgkamat@fb.com> <20180907213405.31574-1-jgkamat@fb.com> MIME-Version: 1.0 X-Originating-IP: [2620:10d:c090:200::7:36ec] X-ClientProxiedBy: BN6PR18CA0017.namprd18.prod.outlook.com (2603:10b6:404:121::27) To MWHPR15MB1230.namprd15.prod.outlook.com (2603:10b6:320:23::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e2037575-4b80-451c-3940-08d61509c1a9 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:MWHPR15MB1230; X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1230;3:kP8DpJipedoPsY5lciG6SJ+OleGQfV3KZ4PyhOFlshk/OeQ4vU7kW7Ztq8ZW25fCHh7QFKWZVCR7rIxQr4McY2PIJoCR1AKZ+O2GKPM3lqgQurcSOIEbRNmxQpb2yrVouo5THQtxCiI1FP9nO/7YtlXcfsMmC8GQ/RIPia0xWu20bI5DwMkjLlOJeDWcVDY7wHR27cZVOLuNKuQJGvPs9WaMYgpSE2KSr8XHCmv0n38yDA61+HeiV0l2jBIy5aUF;25:Sm0qvhG94vw+7+v7ATJhJmJPMczitdTs66cOm3fmAah/jA9IuzTGWPH6UPgMqli8sEYGqsGmsMuxxIWe0mThsbFBhVypyN/X7VzoMuh+ks70hHGC+iWIs8yrCJVLoZ05Uzs/A83XGuXuJQzbOZtTmN5tsTdt9ZE/qNF/dukWtEg6tE6JoIt2pyhYc+YzVLNmtmWlyRtqsP++LhGfsXfcpR4dH/Hn3ps3q4CLPRpZnJkpDExIQp7fnc/nDjl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YhMnGJ4gDq+o631mTbaPZAKhD1mNaqiXDoTq3X7SEGMwzTw1BDF2L4VXqwZ+zecO8h4BQIq15gfjPXKKPitU6N0wIuCtDZzbgzYxWv18gVWtewuPWuzIhfyBx7zQAmFwjp7ENX39r9DOuUobwz7RlhmF3q/WR3d X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(93006095)(93001095)(3002001)(10201501046)(3231311)(11241501184)(944501410)(52105095)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699050);SRVR:MWHPR15MB1230;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1230; X-Forefront-PRVS: 07880C4932 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(39860400002)(366004)(136003)(396003)(376002)(346002)(189003)(199004)(446003)(105586002)(11346002)(53416004)(25786009)(69596002)(52396003)(76176011)(97736004)(52116002)(16526019)(51416003)(85782001)(186003)(486006)(4326008)(47776003)(478600001)(54906003)(1076002)(16586007)(6506007)(316002)(386003)(6116002)(2351001)(39060400002)(106356001)(50226002)(476003)(6486002)(2616005)(5660300001)(36756003)(81156014)(7736002)(305945005)(9686003)(6512007)(2361001)(50466002)(53936002)(81166006)(8676002)(33896004)(6666003)(48376002)(46003)(86362001)(6916009)(2906002)(68736007)(8936002)(85772001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1230;H:vall.thefacebook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1230;23:ncA5r26CIsTXz8y0qEKvGTV6RJ4xgshtTF176Bg8J4g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VmvR+ctIPNjDhbvEe6CbQlgq8zFqTd0ZaBPDxqEAQthetJmJq+3zj9tBZld2zonXe3Kf6+ShA==;5:yiRc66T/Qqyu+o/4/P8IbBzl6laKujSFV3Kbggqpe1l0e0EQpPew8ufZqImLwj4fstvIJfRZ4FmYXCwhy5RlSY2PUgSW5h1+Co1mgZb/TIqD1tTdU1R+vTLoNvTUtVGq5BMOJcsLhnlsxdraQLImPK6ggjurMkTM3OOp5oxF0oo=;7:e8KvatPm60adHGSHXANXp0Wo3BlcmKCjh3q5+iVdpeJrUbBJ+PoJhfOI7+TvpJ7vz1tb4HWZDbulRQZ1uos8zakTJyQLljSH6mft16K+tPHzkXkx+ZQwRcyJ6nsC/N02aYuZFJhiSOuVJwzA81PUFudniLCKBs9TvQlFVSJECRoabh+op1ag2LODfy2XJa6oJhez61lR79a/1DgMjUjc8ZAkBtGTYwtzAie5D3NwX6Kj6g6T1hIY68XJUO9Pw5Im SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1230;20:PygjbWEmXt2C4aU4zcKbtlC7hvesncytTyNuo8y9UMWUMgqv61aVX7O1PW9aBl/4jtmxaSGpFwHdR9Y7cRJFv3JZjVXgJTk418XCgzCn/99m6586OeJvude46KOaUHKvZURhuyDudhdOoAoKEA6YvSanwSExrfmnTTcienXXkd4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2018 21:34:55.0881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2037575-4b80-451c-3940-08d61509c1a9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1230 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-07_11:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jay Kamat Fix a couple issues with cg_read_strcmp(), to improve correctness of cgroup tests - Fix cg_read_strcmp() always returning 0 for empty "needle" strings. Previously, this function read to a size = 1 buffer when comparing against empty strings, which would lead to cg_read_strcmp() comparing two empty strings. - Fix a memory leak in cg_read_strcmp() Fixes: 84092dbcf901 ("selftests: cgroup: add memory controller self-tests") Signed-off-by: Jay Kamat Acked-by: Roman Gushchin --- tools/testing/selftests/cgroup/cgroup_util.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c index 1e9e3c470561..8b644ea39725 100644 --- a/tools/testing/selftests/cgroup/cgroup_util.c +++ b/tools/testing/selftests/cgroup/cgroup_util.c @@ -89,17 +89,28 @@ int cg_read(const char *cgroup, const char *control, char *buf, size_t len) int cg_read_strcmp(const char *cgroup, const char *control, const char *expected) { - size_t size = strlen(expected) + 1; + size_t size; char *buf; + int ret; + + /* Handle the case of comparing against empty string */ + if (!expected) + size = 32; + else + size = strlen(expected) + 1; buf = malloc(size); if (!buf) return -1; - if (cg_read(cgroup, control, buf, size)) + if (cg_read(cgroup, control, buf, size)) { + free(buf); return -1; + } - return strcmp(expected, buf); + ret = strcmp(expected, buf); + free(buf); + return ret; } int cg_read_strstr(const char *cgroup, const char *control, const char *needle) From patchwork Fri Sep 7 21:34:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jay Kamat X-Patchwork-Id: 10592557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9CF9314E0 for ; Fri, 7 Sep 2018 21:35:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BA512B6BD for ; Fri, 7 Sep 2018 21:35:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E8C12B6C1; Fri, 7 Sep 2018 21:35:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2E3C2B6BD for ; Fri, 7 Sep 2018 21:35:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728106AbeIHCSA (ORCPT ); Fri, 7 Sep 2018 22:18:00 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:33750 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728060AbeIHCR6 (ORCPT ); Fri, 7 Sep 2018 22:17:58 -0400 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.22/8.16.0.22) with SMTP id w87LXsrs000946; Fri, 7 Sep 2018 14:35:03 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=oTxGKhiP+NEww54oxcXkTwqCdMKJjkNRMV5elPBvqmI=; b=GJ4lf/ofUcU9QS+BM+sKi7llUtw2RDVadn1CgL0Gwg6Rirfc/86oVSE3zNWPD/9JqbIW bA3PYQQ4kSiMtkTngP0R6k+zW0vF6HWsXk7UtSTheM+Lsqid+BjQ7scbbqGDLOBIqtM2 VQD+38n3ie8ZcZLByk7TKHAxtu91R2fpF2k= Received: from maileast.thefacebook.com ([199.201.65.23]) by m0089730.ppops.net with ESMTP id 2mc131g1p4-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 07 Sep 2018 14:35:03 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.33) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 7 Sep 2018 17:35:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oTxGKhiP+NEww54oxcXkTwqCdMKJjkNRMV5elPBvqmI=; b=k0QTgckZu4lgG+BJ6msQtxDKne1IM6amcfss3UI5TNBpk32p8buj/hnKxoBCSVilXgaAHANQA/k1cM2vLyUkcnEXuntoQ2ABW6ESM8qVnEZyb3eiAlihDarNHNFbezURk6sqSkJXNI/NzwFrXMFXmarHqrfIddUN6eqknsQ8AlE= Received: from vall.thefacebook.com (2620:10d:c090:200::7:36ec) by MWHPR15MB1230.namprd15.prod.outlook.com (2603:10b6:320:23::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.15; Fri, 7 Sep 2018 21:34:58 +0000 From: To: CC: , Roman Gushchin , Tejun Heo , , , , Subject: [PATCH v3 2/2] Add tests for memory.oom.group Date: Fri, 7 Sep 2018 14:34:05 -0700 Message-ID: <20180907213405.31574-3-jgkamat@fb.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180907213405.31574-1-jgkamat@fb.com> References: <20180907164924.13789-1-jgkamat@fb.com> <20180907213405.31574-1-jgkamat@fb.com> MIME-Version: 1.0 X-Originating-IP: [2620:10d:c090:200::7:36ec] X-ClientProxiedBy: BN6PR18CA0017.namprd18.prod.outlook.com (2603:10b6:404:121::27) To MWHPR15MB1230.namprd15.prod.outlook.com (2603:10b6:320:23::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d950a612-607c-4200-4b19-08d61509c3d1 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:MWHPR15MB1230; X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1230;3:BZgjMGgw3w0M4AGJw60GMua/Ecu20OUlibWEQqN5ahsFOp8sLKJdEot4Tg93nbB3ipOZxFNg6Lh4Cwjnci+ywxvrZpnLmM9L06DH08U5IKMAoSxaX8U/DgEqIKJ37z9Z4btm1l6uaNeNuFfTXYPMwkiWvFbRSiPkPsdSMTN0Wzw2j67x1nYiDchGejREplHkHK93/W8D+DZHa67iy+1N2QxNA0IjJzkKD0qf1OnilRr2mRGY0LMuhX+l415KHrbY;25:DRnH+3xWxM6jrveYqT5IuelwuZ9g7yhS4LM4hRNb5SD2afti6psk9mGQig6MkBtx/YQ9QM//mFtZYofQmT0HwfKeZ40tGn1gMZNOVRAZ+iLbm6A7GSQOlGYmhbNaq7nG/tnDbLjXtl/5NStipQ5eQ777LCx3aIQD3DJ+jSvpLxJ1aZX82o1G+bwK2Igmzlha/CYShlynz+aY0bIiddjs7fRhKXMiMx+e/YNjAPdSl+xbfkYHdg19xLBhh0Q1YbGRayBvQESLwHxVBvwlIDZ0QiXw6BhWxpAzXBJADb8Xk8BFlzn8U2sBeYEE33Ws5mecrRkPqlTxlXw8mUx2w/ZjwA==;31:vj6oQ5UcN71+/BawpSk5GxBlJ0L4n9OXxW7qdL1dmxLGw69ZsUkCL1cZ+/5En+wHcv1bAYd85F1x0xGrKhICzW9s6qolgg5yRt1TZ95Z2x2MqdZ/HtcapfkMyTrqdNnL+X5mLGk1D393HMV0C23AA5mntzPMFRXd6xm4gswesuDFOsNf6TIeGO3BQjTiT86CCPpngewcjYplSig8xvyT9pLQ5VLWTnshdCHIe+OPbqQ= X-MS-TrafficTypeDiagnostic: MWHPR15MB1230: X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1230;20:Y+4gP3WsLaCU/WZqLqKhGv8dPL6HpUn+NCMt3BLBnloaFUPVS9dpbWCaoWDgXUFBvigRgsw234NCqPgAvi+iq7829vzIKfeevqax1QjnmaqBBiQMlc7CyWnK881NOByssRyqxJli9kX70VrRs08cMVe0M/OPelni2M+0fB0GpBOozQYZ+IRy/6/h5Bix7J+z/cNb6vftydre0Kul8IU2+y99B+rP0Y4LRzrD9cP3j2AD8cSYoqt85AUfcE0Eck83UXUz3y1SD/tvmYPbwgBc1MGUTVQ0zusN5WkqUjhGGsqtNhCvHGdywWbOV7lwv/uXWMJZGBhoegls4IBDG4r8wOqxk6a41v/oicVC2wIwq3R17OQLnj5cXAe0aahf7UuV89Lf3aQNbWorNVXNmYurDJpRdhLI5r8vuNLTq51xyjDMnoJZAWvGpC0Pqa6Mhjidq15PrIRKfNGFdOyDT0NsCmpl7IhYZZRbDrddG/ehemSfzIX61xp+6n5tlT5OLXu8;4:+kA8tGLTyZbnLtfgxg1Y0cEB8CVcNjDCRQfMy/9szKugl2reuP5CfTLY+Bj7+Hr2PrF1quVoknqe73KO8Z60zkNdUUBFz5TkeM8+BmREW2XNFOW7/fyaXmGNfC21NEMMkhVwkOiHq7SB6IAOkCzl/Jq3NquY2/6k/ZJB/x4/I0e4NjYBKfc7v+hDtwrLP6NJKHoRXSyJAkh+ytzJrCYMu3xnBcwsHz+6YeiywsYRYtWMVmeSy3FZuWw9JE5eGFsFP6rdcmIcAx6WE85f87PlrIsPRmb68iHLG8/anQMnrBtqfmNengcNMIr7CT6TDzaN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(93006095)(93001095)(3002001)(10201501046)(3231311)(11241501184)(944501410)(52105095)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699050);SRVR:MWHPR15MB1230;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1230; X-Forefront-PRVS: 07880C4932 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(39860400002)(366004)(136003)(396003)(376002)(346002)(189003)(199004)(446003)(105586002)(11346002)(53416004)(25786009)(69596002)(52396003)(76176011)(97736004)(52116002)(16526019)(51416003)(85782001)(186003)(486006)(4326008)(47776003)(478600001)(54906003)(1076002)(16586007)(6506007)(316002)(386003)(6116002)(2351001)(39060400002)(106356001)(50226002)(476003)(6486002)(2616005)(5660300001)(36756003)(81156014)(7736002)(305945005)(9686003)(6512007)(2361001)(50466002)(14444005)(53936002)(81166006)(8676002)(33896004)(6666003)(48376002)(575784001)(46003)(86362001)(6916009)(2906002)(68736007)(8936002)(85772001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1230;H:vall.thefacebook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1230;23:no6Rq0oWb8LMz4vQgOAyHYRqBIA9iu/eC4+GJ/WP9Aj8lgefEjuaNb31ac0cAo4oAMm/CeBdpIl0NLbzvgVvYb03jMbmSr73DWcqFT8qprq0sBZIFHhaIF6GlUJlt87wYxjZEWzmR8MVxJWQstHDkzRDlOF6nq6VFrvnbCtpPkNzVOeDRvoVjR+KciXin4pSZk6jyLT7O82StYEl3zSDAj580lr010voC18d/DyLFgaRZPEgTFKOnXQuVUwWtTi88TayQPz+C01Br5SbNw+QcV8xZyGutGeeC25ogyzxGM/w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FoOSHhdDjKRr43A=;7:YSO2xX5Sq8fqt74NY9YlWhNyXgP8jM8tDy2MY60Y0kd8waFF5NCcW3hyHxmjwxIzaHT5GSylxOT/rETwoqillpBAIY+PkWWvJW/7YxR6GEfkXgdCuzzXKF5wPzoeI0/b4uV7CU8icwTNoz3p6BKMF01e6Zw0o0rkv6/N4bgHutbIdtnpryk0MbiH7NQNUAfhptCcstmGIjZl2wPauP7NAUSdOamx0//0u3UmQe4wMypzXfu+C618xSGTf5Bs8jGL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1230;20:8oT07ZfGQJesM9NNR3ZwpsB8Y4tygR6kKZvk0pM2rhwn+Rmod+5dk/4oar/U9Uhn7pMrBntBEYQvDNsyDfy2cozWJwfmPY3eXUimAa5e+G9gZf7e6lFBmz13Kp74l8erUA4jbgCvTs18X5oqq9m6yIPRV15kEQ7gVfL8oBcyj74= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2018 21:34:58.7042 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d950a612-607c-4200-4b19-08d61509c3d1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1230 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-07_11:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jay Kamat Add tests for memory.oom.group for the following cases: - Killing all processes in a leaf cgroup, but leaving the parent untouched - Killing all processes in a parent and leaf cgroup - Keeping processes marked by OOM_SCORE_ADJ_MIN alive when considered for being killed by the group oom killer. Signed-off-by: Jay Kamat Acked-by: Roman Gushchin --- tools/testing/selftests/cgroup/cgroup_util.c | 21 ++ tools/testing/selftests/cgroup/cgroup_util.h | 1 + .../selftests/cgroup/test_memcontrol.c | 205 ++++++++++++++++++ 3 files changed, 227 insertions(+) diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c index 8b644ea39725..e0db048331cb 100644 --- a/tools/testing/selftests/cgroup/cgroup_util.c +++ b/tools/testing/selftests/cgroup/cgroup_util.c @@ -340,3 +340,24 @@ int is_swap_enabled(void) return cnt > 1; } + +int set_oom_adj_score(int pid, int score) +{ + char path[PATH_MAX]; + int fd, len; + + sprintf(path, "/proc/%d/oom_score_adj", pid); + + fd = open(path, O_WRONLY | O_APPEND); + if (fd < 0) + return fd; + + len = dprintf(fd, "%d", score); + if (len < 0) { + close(fd); + return len; + } + + close(fd); + return 0; +} diff --git a/tools/testing/selftests/cgroup/cgroup_util.h b/tools/testing/selftests/cgroup/cgroup_util.h index fe82a297d4e0..cabd43fd137a 100644 --- a/tools/testing/selftests/cgroup/cgroup_util.h +++ b/tools/testing/selftests/cgroup/cgroup_util.h @@ -39,3 +39,4 @@ extern int get_temp_fd(void); extern int alloc_pagecache(int fd, size_t size); extern int alloc_anon(const char *cgroup, void *arg); extern int is_swap_enabled(void); +extern int set_oom_adj_score(int pid, int score); diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index cf0bddc9d271..28d321ba311b 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -2,6 +2,7 @@ #define _GNU_SOURCE #include +#include #include #include #include @@ -202,6 +203,36 @@ static int alloc_pagecache_50M_noexit(const char *cgroup, void *arg) return 0; } +static int alloc_anon_noexit(const char *cgroup, void *arg) +{ + int ppid = getppid(); + + if (alloc_anon(cgroup, arg)) + return -1; + + while (getppid() == ppid) + sleep(1); + + return 0; +} + +/* + * Wait until processes are killed asynchronously by the OOM killer + * If we exceed a timeout, fail. + */ +static int cg_test_proc_killed(const char *cgroup) +{ + int limit; + + for (limit = 10; limit > 0; limit--) { + if (cg_read_strcmp(cgroup, "cgroup.procs", "") == 0) + return 0; + + usleep(100000); + } + return -1; +} + /* * First, this test creates the following hierarchy: * A memory.min = 50M, memory.max = 200M @@ -964,6 +995,177 @@ static int test_memcg_sock(const char *root) return ret; } +/* + * This test disables swapping and tries to allocate anonymous memory + * up to OOM with memory.group.oom set. Then it checks that all + * processes in the leaf (but not the parent) were killed. + */ +static int test_memcg_oom_group_leaf_events(const char *root) +{ + int ret = KSFT_FAIL; + char *parent, *child; + + parent = cg_name(root, "memcg_test_0"); + child = cg_name(root, "memcg_test_0/memcg_test_1"); + + if (!parent || !child) + goto cleanup; + + if (cg_create(parent)) + goto cleanup; + + if (cg_create(child)) + goto cleanup; + + if (cg_write(parent, "cgroup.subtree_control", "+memory")) + goto cleanup; + + if (cg_write(child, "memory.max", "50M")) + goto cleanup; + + if (cg_write(child, "memory.swap.max", "0")) + goto cleanup; + + if (cg_write(child, "memory.oom.group", "1")) + goto cleanup; + + cg_run_nowait(parent, alloc_anon_noexit, (void *) MB(60)); + cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); + cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); + if (!cg_run(child, alloc_anon, (void *)MB(100))) + goto cleanup; + + if (cg_test_proc_killed(child)) + goto cleanup; + + if (cg_read_key_long(child, "memory.events", "oom_kill ") <= 0) + goto cleanup; + + if (cg_read_key_long(parent, "memory.events", "oom_kill ") != 0) + goto cleanup; + + ret = KSFT_PASS; + +cleanup: + if (child) + cg_destroy(child); + if (parent) + cg_destroy(parent); + free(child); + free(parent); + + return ret; +} + +/* + * This test disables swapping and tries to allocate anonymous memory + * up to OOM with memory.group.oom set. Then it checks that all + * processes in the parent and leaf were killed. + */ +static int test_memcg_oom_group_parent_events(const char *root) +{ + int ret = KSFT_FAIL; + char *parent, *child; + + parent = cg_name(root, "memcg_test_0"); + child = cg_name(root, "memcg_test_0/memcg_test_1"); + + if (!parent || !child) + goto cleanup; + + if (cg_create(parent)) + goto cleanup; + + if (cg_create(child)) + goto cleanup; + + if (cg_write(parent, "memory.max", "80M")) + goto cleanup; + + if (cg_write(parent, "memory.swap.max", "0")) + goto cleanup; + + if (cg_write(parent, "memory.oom.group", "1")) + goto cleanup; + + cg_run_nowait(parent, alloc_anon_noexit, (void *) MB(60)); + cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); + cg_run_nowait(child, alloc_anon_noexit, (void *) MB(1)); + + if (!cg_run(child, alloc_anon, (void *)MB(100))) + goto cleanup; + + if (cg_test_proc_killed(child)) + goto cleanup; + if (cg_test_proc_killed(parent)) + goto cleanup; + + ret = KSFT_PASS; + +cleanup: + if (child) + cg_destroy(child); + if (parent) + cg_destroy(parent); + free(child); + free(parent); + + return ret; +} + +/* + * This test disables swapping and tries to allocate anonymous memory + * up to OOM with memory.group.oom set. Then it checks that all + * processes were killed except those set with OOM_SCORE_ADJ_MIN + */ +static int test_memcg_oom_group_score_events(const char *root) +{ + int ret = KSFT_FAIL; + char *memcg; + int safe_pid; + + memcg = cg_name(root, "memcg_test_0"); + + if (!memcg) + goto cleanup; + + if (cg_create(memcg)) + goto cleanup; + + if (cg_write(memcg, "memory.max", "50M")) + goto cleanup; + + if (cg_write(memcg, "memory.swap.max", "0")) + goto cleanup; + + if (cg_write(memcg, "memory.oom.group", "1")) + goto cleanup; + + safe_pid = cg_run_nowait(memcg, alloc_anon_noexit, (void *) MB(1)); + if (set_oom_adj_score(safe_pid, OOM_SCORE_ADJ_MIN)) + goto cleanup; + + cg_run_nowait(memcg, alloc_anon_noexit, (void *) MB(1)); + if (!cg_run(memcg, alloc_anon, (void *)MB(100))) + goto cleanup; + + if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 3) + goto cleanup; + + if (kill(safe_pid, SIGKILL)) + goto cleanup; + + ret = KSFT_PASS; + +cleanup: + if (memcg) + cg_destroy(memcg); + free(memcg); + + return ret; +} + + #define T(x) { x, #x } struct memcg_test { int (*fn)(const char *root); @@ -978,6 +1180,9 @@ struct memcg_test { T(test_memcg_oom_events), T(test_memcg_swap_max), T(test_memcg_sock), + T(test_memcg_oom_group_leaf_events), + T(test_memcg_oom_group_parent_events), + T(test_memcg_oom_group_score_events), }; #undef T