From patchwork Thu Jan 30 16:13:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1231463 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 487llb1cjHz9sRG for ; Fri, 31 Jan 2020 03:13:46 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0EAB33C23BF for ; Thu, 30 Jan 2020 17:13:42 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [217.194.8.4]) by picard.linux.it (Postfix) with ESMTP id D24B43C2399 for ; Thu, 30 Jan 2020 17:13:39 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 409261000946 for ; Thu, 30 Jan 2020 17:13:38 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 878E5AC2C for ; Thu, 30 Jan 2020 16:13:38 +0000 (UTC) From: Martin Doucha To: ltp@lists.linux.it Date: Thu, 30 Jan 2020 17:13:37 +0100 Message-Id: <20200130161337.31614-1-mdoucha@suse.cz> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [PATCH] Taunt OOM killer in fork12 setup() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" On a system with low memory, fork12 can trigger OOM killer before it hits any fork() limits. The OOM killer might accidentally kill e.g. the parent shell and external testing tools will assume the test failed. Set high oom_score_adj on the fork12 process so that the OOM killer focuses on it and its children. Signed-off-by: Martin Doucha --- testcases/kernel/syscalls/fork/fork12.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testcases/kernel/syscalls/fork/fork12.c b/testcases/kernel/syscalls/fork/fork12.c index 75278b012..99b6900f4 100644 --- a/testcases/kernel/syscalls/fork/fork12.c +++ b/testcases/kernel/syscalls/fork/fork12.c @@ -108,6 +108,8 @@ int main(int ac, char **av) static void setup(void) { tst_sig(FORK, fork12_sigs, cleanup); + /* Taunt the OOM killer so that it doesn't kill system processes */ + SAFE_FILE_PRINTF(cleanup, "/proc/self/oom_score_adj", "500"); TEST_PAUSE; }