Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4485476yba; Sun, 19 May 2019 20:57:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwN3eiseL9UdSW6wafFFTMo3W+fSd5PknCQHLJTPZLh0AhfMseH0ybFAjfW2DrSqQlG+BNr X-Received: by 2002:a63:5659:: with SMTP id g25mr73744685pgm.59.1558324623804; Sun, 19 May 2019 20:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558324623; cv=none; d=google.com; s=arc-20160816; b=nYvftAvTWxJhf3vnoeTkNx62xQ1OF+Gl2xjrw09qmxRh1djM3Ma48HTy/An/RlJLnS nN2ivIRsp1EpcBvNKKNTBASesJsBq79OIL5l0cXNvRQaTacmeWzuzI9SeVm1e+InGwjq NXYwSqWaBaAJkok8CKWZJrbiLxFPgG1LTAfE2vf1yo54vzqwjcYWcGLz4d9ucbHaQl8S L5W3g5lmv3ABq6+YbTwcYmWwuzKok8B9lt+UojdfV5VPk7EuVX9ns/ZuGa1b8oazhrJB WMb+fynl7AgdUJ8b/DIu9z1mAFmSc9PDjV7WUjL3NTYtLr1eLt5fsWjNGyssOyUhoJUi urgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dqUMhsCqLsbEehBA3+3VeJ3u+lspTJCVpC6HBF2I+PU=; b=cfR2JIgDaq+L4bK+oExyYVbcSjOCJ+8WPgvhaf2LQDzVIdyTRxW++bSjDu5nSIjXSN kPatO/yznh1IkoJFphENLK5P/AicSNafw4nbXiP/njQGc+aL34U6dwRkbYJNbAGLoyxK NKN7TgtenKlJvyGfZ99RhsS94UGBzMVTt2TPx4YHdOq09Agkont3G7ClAqWfuOoIyl3x ilsG7OHkzQUBvbntm9dfjqSLTIfjdZBhaCXytaHfDmiLUT4Uq6xkJHvprT+uyiaRIlco Yftssh8AJ3dA3f3X1Zantfjuij7TFxowIUbI054kpT6q42rGcUM0FunjbAYPSruUIx+F ZJ7A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d191si15797479pgc.460.2019.05.19.20.56.48; Sun, 19 May 2019 20:57:03 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730154AbfETDCA (ORCPT + 99 others); Sun, 19 May 2019 23:02:00 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:41498 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727008AbfETDB7 (ORCPT ); Sun, 19 May 2019 23:01:59 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R881e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07417;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0TSAay54_1558321316; Received: from localhost(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TSAay54_1558321316) by smtp.aliyun-inc.com(127.0.0.1); Mon, 20 May 2019 11:01:56 +0800 From: Alex Shi To: cgroups@vger.kernel.org Cc: Alex Shi , Shuah Khan , Roman Gushchin , Tejun Heo , Mike Rapoport , Jay Kamat , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] kselftest/cgroup: fix unexpected testing failure on test_memcontrol Date: Mon, 20 May 2019 11:01:38 +0800 Message-Id: <20190520030140.203605-2-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.856.g8858448bb In-Reply-To: <20190520030140.203605-1-alex.shi@linux.alibaba.com> References: <20190520030140.203605-1-alex.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cgroup testing relies on the root cgroup's subtree_control setting, If the 'memory' controller isn't set, all test cases will be failed as following: $ sudo ./test_memcontrol not ok 1 test_memcg_subtree_control not ok 2 test_memcg_current ok 3 # skip test_memcg_min not ok 4 test_memcg_low not ok 5 test_memcg_high not ok 6 test_memcg_max not ok 7 test_memcg_oom_events ok 8 # skip test_memcg_swap_max not ok 9 test_memcg_sock not ok 10 test_memcg_oom_group_leaf_events not ok 11 test_memcg_oom_group_parent_events not ok 12 test_memcg_oom_group_score_events To correct this unexpected failure, this patch write the 'memory' to subtree_control of root to get a right result. Signed-off-by: Alex Shi Cc: Shuah Khan Cc: Roman Gushchin Cc: Tejun Heo Cc: Mike Rapoport Cc: Jay Kamat Cc: linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Roman Gushchin --- tools/testing/selftests/cgroup/test_memcontrol.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index 6f339882a6ca..73612d604a2a 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -1205,6 +1205,10 @@ int main(int argc, char **argv) if (cg_read_strstr(root, "cgroup.controllers", "memory")) ksft_exit_skip("memory controller isn't available\n"); + if (cg_read_strstr(root, "cgroup.subtree_control", "memory")) + if (cg_write(root, "cgroup.subtree_control", "+memory")) + ksft_exit_skip("Failed to set root memory controller\n"); + for (i = 0; i < ARRAY_SIZE(tests); i++) { switch (tests[i].fn(root)) { case KSFT_PASS: -- 2.19.1.856.g8858448bb