Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3196459lqo; Wed, 15 May 2024 02:38:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBOp7fdyFWVNWklci9L927TWpsEiTn6dUmb6vzZBb7iso01hG3ra0DQVY7fUFapk7c9K8Kckb2Q3x4+JNlWQFkW8lNj8JoQlAR/OCaJQ== X-Google-Smtp-Source: AGHT+IHALTzE7B1nb9sV/QwdGNN5GH4MWAH6AFtn0rq+uXAKlDGpMk51IlDwdqfU5eTt/R9R0dV+ X-Received: by 2002:a05:690c:806:b0:61b:3346:a8ab with SMTP id 00721157ae682-622aff4514cmr133244427b3.4.1715765896369; Wed, 15 May 2024 02:38:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715765896; cv=pass; d=google.com; s=arc-20160816; b=TSdmbw6k/z/JxTtqffoZkGuckX/g+hA+D98iLCnAOljMrAXFTuBkMNpkOtXdtX180k iozfJ4iCsg0zdpYgpuJ5xSDCpUrrZNEJX4mloBL9eNfL4TtMPhTvULfIFVy9gBj56GMj x3l6WGttkR/BFDiS60UYxhZoxYDvTgq+BwauVYhrwpqFuUj1HCFdTdeJZXvS1NKZW3Yp 340AGNKhSLgY/W7ob4e1+AOCesfDZxcVw+OZlsYrf6Fv/JqVbkqMHhWprrETBjwM8gvf UjXpbw7t5yDoZaJ6t3hG8pjh9LR+XA5fpPaykvnGv/dk1MNLDwMfDZsTSuIpoyqMWgzh i0Sw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=V1hD2OADbtQxHRJVDyKFEZJi+Pi9K/ReTRcMInFlQu8=; fh=FvHTgKIxnKY5XMkljZGc9WlNm5ybPl3APPghB7+TOLw=; b=WBhifjXpnkrrUfWhgXtCTVNAzRc6imU3yMaz3aHrKo97lSQzcx8GTfRwzVIGNyhtUS wSLj9Gc/4wAFVn0aJNteNm/tfH8gQZzQgeiK0e23P8esvmfydY00v6d3UlqV98xVpH7P fKbCsIXrRdf/iL+oFOyu8Wfs7xLGaWXdGpY+iQYDDlFkXwfe0cG3hShEv6dXrOiBLTkB vJ5aiWyoNCH1sGYPBfvFud+4Ruwh9zmh7isJlCp76ya3ulAOAup8KsoLahE4vwHwTqmp v2TuUNyqQmC5rtp7uPBDjD8ATlXUZIxOTW18PKRnDlzcVVnCyCaKb32xsOTYImQvv99q 2f9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-179713-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43df54b57edsi131261941cf.195.2024.05.15.02.38.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 02:38:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179713-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-179713-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 29CD31C230A5 for ; Wed, 15 May 2024 09:37:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4703E5EE97; Wed, 15 May 2024 09:37:06 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 668902744C; Wed, 15 May 2024 09:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715765825; cv=none; b=kdK33Jpco9ziaviqSwsvmk5vd/aTxSp04YoNCRQPxi/oc62ozkXquwLz7uf4FOyyvq8RdkPumgIJYl0eCzIc7CDN/oFISwlrIB7lPQ6WwUL4vc7UaKWScesOpXk6vlSpJid4D3pfNn/ney9XT/MxsNOnkO2GU2i3IJ7Kf9lGI1U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715765825; c=relaxed/simple; bh=zNQ2NzOouLlV78Yiedaiqaes0qVGsXsk8gwCDZjyNSM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WWZT9P3kuWD/er1KLIoqh2msVVIlcGHgnTDc/JSLGm8sbJd1rgZq6zEK4c3cXq8MrIRIeFz9lgOEOl2eCEbM0KXpw1QbVhh90YEsK0KxknlqtW+l8hoPakSM1XFHRwUEoKADlR1/1hwlHxBOPjeHecsfkCsJYrko5BKdByOt0zs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD0F51042; Wed, 15 May 2024 02:37:22 -0700 (PDT) Received: from e116581.blr.arm.com (e116581.arm.com [10.162.42.15]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0AE0F3F7A6; Wed, 15 May 2024 02:36:54 -0700 (PDT) From: Dev Jain To: akpm@linux-foundation.org, shuah@kernel.org Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Anshuman.Khandual@arm.com, sjayaram@akamai.com, Dev Jain , stable@vger.kernel.org Subject: [PATCH 1/2] selftests/mm: compaction_test: Fix incorrect write of zero to nr_hugepages Date: Wed, 15 May 2024 15:06:32 +0530 Message-Id: <20240515093633.54814-2-dev.jain@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515093633.54814-1-dev.jain@arm.com> References: <20240515093633.54814-1-dev.jain@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit nr_hugepages is not set to zero because the file offset has not been reset after read(). Fix that using lseek(). Fixes: bd67d5c15cc1 ("Test compaction of mlocked memory") Cc: stable@vger.kernel.org Signed-off-by: Dev Jain --- Merge dependency: https://lore.kernel.org/all/20240513082842.4117782-1-dev.jain@arm.com/ Andrew, does it sound reasonable to have the fixes tag in the above patch too, along with this series? tools/testing/selftests/mm/compaction_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c index 533999b6c284..c5be395f8363 100644 --- a/tools/testing/selftests/mm/compaction_test.c +++ b/tools/testing/selftests/mm/compaction_test.c @@ -107,6 +107,8 @@ int check_compaction(unsigned long mem_free, unsigned int hugepage_size) goto close_fd; } + lseek(fd, 0, SEEK_SET); + /* Start with the initial condition of 0 huge pages*/ if (write(fd, "0", sizeof(char)) != sizeof(char)) { ksft_print_msg("Failed to write 0 to /proc/sys/vm/nr_hugepages: %s\n", -- 2.30.2