Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1001392rdd; Wed, 10 Jan 2024 06:02:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhPVzaPXRiT4AyGDTJojbc/GJJYja7+Sxj0L7dfSOCIFs7iCFwZYeV2DZ30llK1o/DWqiM X-Received: by 2002:a50:8e43:0:b0:558:53b9:7cbd with SMTP id 3-20020a508e43000000b0055853b97cbdmr282284edx.19.1704895333083; Wed, 10 Jan 2024 06:02:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704895333; cv=none; d=google.com; s=arc-20160816; b=0oy35JbD7oe1bW6oHfB6dE26KtCXrsCxRXWCH4GSFLnQKYZsB1T4XYhmM/4gRnqhZl J6OV4/eMyuZsbj4bSD6oa1pZrPtGILhZkTqyS8Xv7BrO79i2o5SMF84oj93EAlqLDuVB 93Sy9gYO5L0ni3o37bqqUwrQxCmN0WfjJ7Nj3Pxani0n4ob73LbJW9S1iM59eGA+T9hD wOAuIINuKynqAsxYcRBN1h+43OExn/NiXQqEaEYxIJboejr+SVk1GszkZPX88CbuieH7 phzPrSLfMUz7j+V9T/vmxG5xRIKAlLkzh3EgBg9xjkF2+6QEVO69UmLyPDBeVehA7qXM xkQA== ARC-Message-Signature: i=1; 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:message-id:date:subject:cc:to :from:dkim-signature; bh=PfxT8EmwmFjjW5GAzJtI4xhYCxTVYs+9fiE3LzkKW0M=; fh=KVbvSTWDOOahD5Zl3oUI5pu33yagFdRnrk8bsycxm1w=; b=K1wSFcu1iWFVrD2N9sk3gdkVCpi55bF4lFOOZbC5fPFfBGaV6Lond6BrdjL9s+OZal LPfjoTPt6V/1or5EWFVccGW14RFPGiTUKey+JQSanzEjYl/DJY4UlASbZZtYxh+B7BmS XcdMTRrW7fOuDh2cU9tFgYe9zAH/FBwgPyMvml6m8sA31o7g9xBH4mK0rEhS7mRfRN6I VbfkRjrDVD3YeFFQvk77Uop5Rvs+zFc9SXax/TWaAyHUSmQ3GwcL5qa5VwVFJT8AEXP1 AjM8kyxojvmSScU60ncCqY7+V01qsiBu+3ds87QrnlBUk8PuuLAhQBgbRPC4qOv9Dfs9 +m3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=aXPEbR+h; spf=pass (google.com: domain of linux-kernel+bounces-22297-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22297-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p1-20020a50cd81000000b0054d884a0d01si1757422edi.572.2024.01.10.06.02.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 06:02:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22297-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=aXPEbR+h; spf=pass (google.com: domain of linux-kernel+bounces-22297-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22297-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.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 am.mirrors.kernel.org (Postfix) with ESMTPS id CFFFA1F2125F for ; Wed, 10 Jan 2024 14:02:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2637495F1; Wed, 10 Jan 2024 14:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="aXPEbR+h" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36063495CD; Wed, 10 Jan 2024 14:02:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40AD7Crh007939; Wed, 10 Jan 2024 14:01:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=PfxT8EmwmFjjW5GAzJtI4xhYCxTVYs+9fiE3LzkKW0M=; b=aXPEbR+h7x2iTM4dXrKhvGGx9DczTf6raefRo5ojFWj+EhKTZkYnD+Bjn6p9a5Ndxoge N5VW28QlZBoH/Zl1C5WIzcjpwdcGjpY/LLMIRnhNMUj5HiwJaSMnS76hS9wHyebEmGJm WWowBOs4NJAIIWJ1v0BJ4OCJhSpLzUbMfKPxxxd9Byrz6ZJ6mQjQ+edXPfMW1vaDi2Af SCLvdPNi6yQ+BSNMMlbosNcmsb6h/5wB6NhehsqNYDv4o3Lw2x7uHong9dQFqLWN50FQ mzqnrz+SSbHG1OvrpxUv0F7fNrlTiSdQtOuD8LAgcE3N4c8iASnkn+5XOQBehaZtr6Ot tw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vhuu9h7fd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jan 2024 14:01:42 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 40ADjlMe004079; Wed, 10 Jan 2024 14:01:42 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vhuu9h7ed-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jan 2024 14:01:41 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 40ACSXXI004395; Wed, 10 Jan 2024 14:01:40 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vfjpkwcmp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jan 2024 14:01:40 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 40AE1bIF18350642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jan 2024 14:01:37 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53D7A2004D; Wed, 10 Jan 2024 14:01:37 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2BA7B20043; Wed, 10 Jan 2024 14:01:37 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 10 Jan 2024 14:01:37 +0000 (GMT) From: Sumanth Korikkar To: linux-mm , Andrew Morton , "Aneesh Kumar K.V" , David Hildenbrand Cc: Oscar Salvador , Michal Hocko , Gerald Schaefer , Alexander Gordeev , Heiko Carstens , Vasily Gorbik , linux-s390 , LKML Subject: [PATCH] mm/memory_hotplug: fix memmap_on_memory sysfs value retrieval Date: Wed, 10 Jan 2024 15:01:27 +0100 Message-Id: <20240110140127.241451-1-sumanthk@linux.ibm.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: akujshpMwAbrdtpK1D1VWpnTYq87mmYm X-Proofpoint-ORIG-GUID: 1ES3chf0hnl4bulp882nvtBk7J5ErQgx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-10_06,2024-01-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 mlxscore=0 mlxlogscore=913 lowpriorityscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401100115 The set_memmap_mode() function stores the kernel parameter memmap mode as an integer. However, the get_memmap_mode() function utilizes param_get_bool() to fetch the value as a boolean, leading to potential endianness issue. On Big-endian architectures, the memmap_on_memory is consistently displayed as 'N' regardless of its actual status. To address this endianness problem, the solution involves obtaining the mode as an integer. This adjustment ensures the proper display of the memmap_on_memory parameter, presenting it as one of the following options: Force, Y, or N. Fixes: 2d1f649c7c08 ("mm/memory_hotplug: support memmap_on_memory when memmap is not aligned to pageblocks") Suggested-by: Gerald Schaefer Cc: # v6.6+ Signed-off-by: Sumanth Korikkar --- mm/memory_hotplug.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index b944e8bf1911..707027f69150 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -101,9 +101,11 @@ static int set_memmap_mode(const char *val, const struct kernel_param *kp) static int get_memmap_mode(char *buffer, const struct kernel_param *kp) { - if (*((int *)kp->arg) == MEMMAP_ON_MEMORY_FORCE) - return sprintf(buffer, "force\n"); - return param_get_bool(buffer, kp); + int mode = *((int *)kp->arg); + + if (mode == MEMMAP_ON_MEMORY_FORCE) + return sprintf(buffer, "force\n"); + return sprintf(buffer, "%c\n", mode ? 'Y' : 'N'); } static const struct kernel_param_ops memmap_mode_ops = { -- 2.40.1