From patchwork Tue Jan 9 16:26:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 123972 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4213250qgn; Tue, 9 Jan 2018 08:27:09 -0800 (PST) X-Google-Smtp-Source: ACJfBov3r0BKoK8L9ZAi6aZLnkRDnZzTIIL0co03/SIwf7PDnaBw8Hp6Q028juWX31e5qY6jVZot X-Received: by 10.84.215.15 with SMTP id k15mr3080881pli.197.1515515229685; Tue, 09 Jan 2018 08:27:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515515229; cv=none; d=google.com; s=arc-20160816; b=QXhsSEDb5WTPkQ0Ho+jJIn6skYmJt3YJTBswSaYvR9AArsh7BkbT0L/vQQHbN/BiUb jq0rfDCtFiQYpTpu1MoIwvy5ovXqeVlw7BwGB65tw7yFwi7T6sI9rz2I7EjRiMcCwnFw PZz81NdivaWYfRifydb/Ts929Levb7X/eOQFaNbpeo6hho6nNVOKc/18ITI9nLtadhN3 eTaJRd4eaELAz/FM0L0CQ9T0oKTJAFY3BGKvRkkevStmOfopcWXVvu9oYZEvW/pF67DN L0YXy3sjbSI0qI40jLg+gk+r3mH4iA52aylnkkQW42QHqEdQhe8HmsM6GTebH9Wn20ZF 6irw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=g4napEdT25VpJYdmxwKd8ez6gAV3g2tLJZNQAl1Du20=; b=lwRUmAnbmJbroZZwJY7wMMNer45U58nI7FOyqO0BSshLeLLFD9OrU2PQwcmU0MFK7m odi/Ad1fKYvUb+5kbfb90ITypS9jTwcjhM1NP4X6X+xpsvz9YT1tySugx8P7KSjglbZz TvxPbY1tdU9V/ffmJryLt5gto/nDw4BdmByE0fK6FOuXl9dCazP+3caSf47XC4Jr1ssK 9IDbS29rDgYIGdMs8lCHHe4/PzGZtTXD/pqakQEicw0iZgq9KqCt33zFw7GbB74jxFtM lRDyAUNMNu/RV4ZlpTBM9TrqobRtnxvgmzbRHF+9ouYxuoRBhT+5rckN8H0ifXhvamuF L5Kw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37si10619679plv.284.2018.01.09.08.27.09; Tue, 09 Jan 2018 08:27:09 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759423AbeAIQ1H (ORCPT + 28 others); Tue, 9 Jan 2018 11:27:07 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:50289 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759228AbeAIQ1D (ORCPT ); Tue, 9 Jan 2018 11:27:03 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id 0MDpnS-1eey5g06H8-00HBCh; Tue, 09 Jan 2018 17:26:54 +0100 From: Arnd Bergmann To: Shuah Khan Cc: Sri Jayaramappa , Arnd Bergmann , stable@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] kselftest: fix OOM in memory compaction test Date: Tue, 9 Jan 2018 17:26:24 +0100 Message-Id: <20180109162648.3987382-1-arnd@arndb.de> X-Mailer: git-send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0yQg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Running the compaction_test sometimes results in out-of-memory failures. When I debugged this, it turned out that the code to reset the number of hugepages to the initial value is simply broken since we write into an open sysctl file descriptor multiple times without seeking back to the start. Adding the lseek here fixes the problem. Cc: stable@vger.kernel.org Reported-by: Naresh Kamboju Link: https://bugs.linaro.org/show_bug.cgi?id=3145 Signed-off-by: Arnd Bergmann --- tools/testing/selftests/vm/compaction_test.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.9.0 diff --git a/tools/testing/selftests/vm/compaction_test.c b/tools/testing/selftests/vm/compaction_test.c index a65b016d4c13..1097f04e4d80 100644 --- a/tools/testing/selftests/vm/compaction_test.c +++ b/tools/testing/selftests/vm/compaction_test.c @@ -137,6 +137,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) printf("No of huge pages allocated = %d\n", (atoi(nr_hugepages))); + lseek(fd, 0, SEEK_SET); + if (write(fd, initial_nr_hugepages, strlen(initial_nr_hugepages)) != strlen(initial_nr_hugepages)) { perror("Failed to write value to /proc/sys/vm/nr_hugepages\n");