From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755275AbeAIQrh (ORCPT + 1 other); Tue, 9 Jan 2018 11:47:37 -0500 Received: from mailout.easymail.ca ([64.68.200.34]:39087 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751646AbeAIQrf (ORCPT ); Tue, 9 Jan 2018 11:47:35 -0500 Reply-To: shuah@kernel.org Subject: Re: [PATCH] kselftest: fix OOM in memory compaction test To: Arnd Bergmann Cc: Sri Jayaramappa , stable@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Shuah Khan References: <20180109162648.3987382-1-arnd@arndb.de> From: Shuah Khan Message-ID: <7f319aac-ef79-a7b0-372c-b52062063f97@kernel.org> Date: Tue, 9 Jan 2018 09:47:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180109162648.3987382-1-arnd@arndb.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 01/09/2018 09:26 AM, Arnd Bergmann wrote: > 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(+) > > 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"); > Thanks for the patch. I will get this into 4.16-rc1 thanks, -- Shuah