From patchwork Tue May 21 07:43:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dev Jain X-Patchwork-Id: 13668975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A6E6C25B74 for ; Tue, 21 May 2024 07:44:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C0A236B008C; Tue, 21 May 2024 03:44:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BBA3B6B0092; Tue, 21 May 2024 03:44:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD07E6B0093; Tue, 21 May 2024 03:44:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 913356B008C for ; Tue, 21 May 2024 03:44:29 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5B3E3A27AA for ; Tue, 21 May 2024 07:44:29 +0000 (UTC) X-FDA: 82141615458.13.58617F9 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf23.hostedemail.com (Postfix) with ESMTP id CFF90140019 for ; Tue, 21 May 2024 07:44:27 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of dev.jain@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=dev.jain@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716277467; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kY64uic9X8MEODu3jF/Q5328cwLGr/UFpELqO2UC2cI=; b=BnKCbGrK3tbvguZuV1dr6UWyBerxvfySqXVZGET67Yrgr3xKZrHRAzkre8LP+jJKowqTGM Hn05Kiiz5b6wpXKf3ps8VegHxvv1J64cxcicvORTJ636yKN21gF359efjT0eIdoXwafvBe 211Mb9mWCrZiLBQznV3HtO0bBjN2ZlE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716277467; a=rsa-sha256; cv=none; b=rCqV+75mSeHWedI9YtG+4XnFdlq6L+04p5Z2+HWgwW4DlBMLvTlld0Lg7D/1cqSrbNnZJA DDQYC9NoN4FDACwv82F6RrXRcoGp8gDdaLpnE/pcFLEM2aDIFsYNsN6Irvt+dG7BIW3DKo Rq9BkFkOYdavkKR4zXE/YS2jiFGh2Vw= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of dev.jain@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=dev.jain@arm.com; dmarc=pass (policy=none) header.from=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 2D4CB1042; Tue, 21 May 2024 00:44:51 -0700 (PDT) Received: from e116581.blr.arm.com (e116581.arm.com [10.162.42.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D9DDD3F641; Tue, 21 May 2024 00:44:23 -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 v2 2/3] selftests/mm: compaction_test: Fix incorrect write of zero to nr_hugepages Date: Tue, 21 May 2024 13:13:57 +0530 Message-Id: <20240521074358.675031-3-dev.jain@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240521074358.675031-1-dev.jain@arm.com> References: <20240521074358.675031-1-dev.jain@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CFF90140019 X-Rspam-User: X-Stat-Signature: ztoc5n8fwzbcu4xgfrzou9qjwwcrype6 X-HE-Tag: 1716277467-567167 X-HE-Meta: U2FsdGVkX19nZzHI5P2xQIE4pOuuYh5S3gZbnMlhf/uKl529i7tHFWTx0o23jmAbqdCO24G3KQPgySHnFVM4vVmChQh9nEmYmt7RPaS20AXztFbvNIHk2GVf86L0J2BuBD7JYpnn5tRtCXyALeH/Mujol0D3funuB6w9gJxopE63CPqD2ePauGlprCMA60g0al+dn3PGGJTsYexFzi8JlgYB2+qTJPvTvcy7/mPOoOu0ecgFzcwOrhm4ybvQUfqBhIyVnS1Bwk4jMuB8INPyaHUIXtkjT39Rlf1O2Hts9/0Ep5l5AiFUG7q0biS7Sw0p2LIfgiTYp3NOZ+yUcnfAhKPX6p5P9O6SLVMexTLuK6OC4BBF2+2JPtJG2ejB3HI5kPV/avnMMF41HWC3g2nHuhBB8/J2fwJDA3XP49KYp7v6vbmosL1sc7ZPCKkMwIubkvebry7DNTdbD00NO1f7FOxgYNeVkzwGSElF7vhgiuQH2eaS6MpQO2vbwW3x6COa4lfw/EGB9KM7mVaFE3/t4OdkRifERJxC3v5OVOhRRTdsDyWOhaUgMN13ysWeZkVMjcIKzP12EG9Iz0Kpo+6n+DApA5f8h8q/IcVRod7omfUQZdB9y71ZdettO55lVhOJqzZg/9u4Letg0xIeoCVCrKsOGaKyequZIek2Hs9OhiHYd6W9hL/DtgDJeMKEj1nUPjDdwm1keYBbySsSZskdVQXAKXtpiYP52WjjAlUzA/eiq3qksEmTFS4l4fl1sAfQJh/owfnqxSIemZHRbSJZtWIhMkpRJJ61eOOP5pBuI17YlFzkSG1YWYScBE0FMVMP7UqvnQRIrprpq3EedVUEgJgmy1lvK2cDrC/710ZmX/h5gegi8dS3goBEuhYKfEY3+9uuYlBQCrobHpzq0KNOEGcMaUeS8+FJEc/04e33C1IwQRHZxByWHqVjAII/X2PUeNCFsAQyJrpW3NgK6Js VTMpGmyR nF8Z0jlySAIQQDy2hFNbU+4ptlkE9ee1pCKcxllXF+v0Y6KDDCwt4jY55rZZ8cVYU4A/aKZPrpN9BgiUsWwYihaWtyCDrs9/VOIi4x82hhF1W+TYlymK/vnP/dEX6286R0P4+snQqVZFi0l/bSuB0QVPQypzMG6tIvt5WrfvupHrjkQr4NOSEsc8BJm8Em7s5XfwBCM9KSNmvnDEjdiJS37/DGPCsWLsig7ke9CZulh13AVGg3ojsJOrY1cGqatS4Ry2ZPhLS8WW/8uE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Currently, the test tries to set nr_hugepages to zero, but that is not actually done because the file offset is not reset after read(). Fix that using lseek(). Fixes: bd67d5c15cc1 ("Test compaction of mlocked memory") Cc: stable@vger.kernel.org Signed-off-by: Dev Jain --- 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 0b249a06a60b..5e9bd1da9370 100644 --- a/tools/testing/selftests/mm/compaction_test.c +++ b/tools/testing/selftests/mm/compaction_test.c @@ -108,6 +108,8 @@ int check_compaction(unsigned long mem_free, unsigned long 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",