Received: by 10.223.185.116 with SMTP id b49csp765478wrg; Wed, 21 Feb 2018 06:36:27 -0800 (PST) X-Google-Smtp-Source: AH8x225YgB/lLnDGWIXG/p6H8jZpnjmqDfjePZwKrqIVBrOab6VPAH2X/mfCILJVp/tjKI1j7YOu X-Received: by 10.98.9.5 with SMTP id e5mr3044441pfd.189.1519223786975; Wed, 21 Feb 2018 06:36:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519223786; cv=none; d=google.com; s=arc-20160816; b=tV0u/jd+bKCRrNjVetrzoBPQrxYd2irnVN3lCF5HA+IdygT4UNBo4pb4M3LlwQ5oXc gzHGg7sP+FZ0wzGmKjxw3bZMXqx+hDkNgWdCXvfix+KUQhGrFHm+Qfe64jfvaBWvK5Xd KFIlOn4pXaR73rG6X/kIp/xYPTP8YrsqG9pLXoWYeKHRtEhoqqHDqkDEtU82T3RBe9VA uDtafkZp+VhwBqm4dsHk5e0E/8cORE/c/FS63HWCc4+FEL6WkpNXgPVTpT4/jfylfLK4 JX9FlDEcn4nE7UkVHI6hHl7paGVdM2JRc27p+G05NGJ5/MKGs8R4OxjSI6uIVHnSPTNH I1bg== 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=aD/jjckIipvLqHsICzTXIh/gu7jaaAeix+qkTMjINio=; b=Vcs+XSoULqDrAuH99JmWurbzQzYnu1RqRnM+4JffRIEshS2M8DBO6sx3L9Av0qYfhw H43oXoEQLtaIX03NcWVdfBt5n5mRtMi+0tXdWAIJ23fVER9PnJf1MHgjJwvFvJf8Ki4w if6e9O5qg4QILjW1B/6QNGdWVmY2luaTP54KCGccvhFV/RdIJe5UpMG2IB+GEUGzEjuH KtN8nkbfT9qdFgXP//LyFLMZsQCyT5vAfKmSNkLcDF/d65Kd5xHqBGpPlvOzokdL6jRZ TOd9yk9QC7ejO1Ayw4IuH/Cuprr8AySZ3LbkhfkNC2mxjTOdr09Fw7Aid/EvSKCoumMe qtLw== 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 s12si3104869pgq.491.2018.02.21.06.36.12; Wed, 21 Feb 2018 06:36:26 -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 S934340AbeBUMzn (ORCPT + 99 others); Wed, 21 Feb 2018 07:55:43 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34518 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934328AbeBUMzk (ORCPT ); Wed, 21 Feb 2018 07:55:40 -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 2F2921155; Wed, 21 Feb 2018 12:55:40 +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.9 37/77] kselftest: fix OOM in memory compaction test Date: Wed, 21 Feb 2018 13:48:46 +0100 Message-Id: <20180221124433.736840791@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124432.172390020@linuxfoundation.org> References: <20180221124432.172390020@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.9-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 @@ -136,6 +136,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");