Received: by 10.223.185.116 with SMTP id b49csp1025634wrg; Wed, 21 Feb 2018 10:46:59 -0800 (PST) X-Google-Smtp-Source: AH8x227wxgUlJ/UhD6N+6xhy8JnLULVyrj5Gy2V7tmuc5zMgFmwcSditiKjn7Rss4XLZKTB3LEH7 X-Received: by 10.98.67.157 with SMTP id l29mr4197550pfi.214.1519238819846; Wed, 21 Feb 2018 10:46:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238819; cv=none; d=google.com; s=arc-20160816; b=orfHABgiZnbRgBSxRnpbxDGTR3JNjhnGOrQ5eiDSBGTbiHDyIDRgTzG0Qrsda37nXg Ier3KfKWhyJGtTkqoz59z5YAeZQnIz1oeDZl+beOpBtWZw6L9Z/cK+Tl4A81z9gSXTbM ECVsBVbDdPhIMbqvHv8HHm0eVDn8fB2boDU5bvNvJISTUI5CZwOMa1a2b3lZG3L9v/Wu ARo1wxvu+s3iFaU8I1FS5j8bBIsT0W4VOZ5AUgZHHz2V6Q2rH7mCJqFuYQWLLS0GcXVD 6OI/T37jcCNb1Tid0dvDxfiIsGinmzxsrtrtqaTLHzvtZXqP9kv/Hr1At0PsHtQU/h6e URhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+Jv2ZS98Z/x5AdCDBxcOu4fGcaoiClVSxNmLjZgsdO4=; b=cGojbwaRF9liouD1BccKez/fyA53IVK8YmnXZbNHBNaKroG5K2UltJlRIWwYmZ2Ycx M106EInZNBUnxIR3QlG+Aq6Z0iPqO3NchC5DxuYW1pFPIprzaPT4xmLAA8xn+1gc9iXx V205AHT4c93cFhAuM+41zZB3JF5ApOUGQh4PPp4vLEH/qq/6MAu3qiE8HQg8lEq/u8Zc iLUskWkFifihcWsVp9l95ohX2RrhQeyrckRuNJNM0IYXkC6YtAsfX3jYBpHjAtOK85MN VUz7snFZic8VsosOUQhIVU6gLoEsCNl0r5gmOl0IzbVvWLuMJ5/XE8UsGzUt0f4LB8Tq 1Utg== 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 g2-v6si3245674plt.810.2018.02.21.10.46.44; Wed, 21 Feb 2018 10:46:59 -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 S965738AbeBUNqU (ORCPT + 99 others); Wed, 21 Feb 2018 08:46:20 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:41136 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965003AbeBUNGf (ORCPT ); Wed, 21 Feb 2018 08:06:35 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B79B0DA8; Wed, 21 Feb 2018 13:06:34 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naresh Kamboju , Arnd Bergmann , Shuah Khan Subject: [PATCH 4.15 009/163] kselftest: fix OOM in memory compaction test Date: Wed, 21 Feb 2018 13:47:18 +0100 Message-Id: <20180221124530.494842645@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 4c1baad223906943b595a887305f2e8124821dad upstream. 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 Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/vm/compaction_test.c | 2 ++ 1 file changed, 2 insertions(+) --- 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_f 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");