From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 50345387365 for ; Mon, 2 Mar 2026 08:00:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772438420; cv=none; b=IqO5y11p/zjeI3eWusBXvI2ORTjB9qtDSrrvM+R9w1yB1DeWAjr7KU/0MOg5BRN/GzOt+BaddvYKZhLUx21NA3kkCE9W7Ae9b2hPgl+MNsQgztAF7HSZisvYk+f+9/YW2T/iOTSd+dJ2p5y2mEqmmrq+sjDfdlm9eE7/P2RgC0Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772438420; c=relaxed/simple; bh=3/LPu8Gts57wbVnF84SMwpPToGqL3wOUTkkMJnDpAvY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ohQWioqhqoJ6prWv+qQH9NB0YU8T22U4bxeqbwqN6R4Ut2Tog9iVa9+RKFWfAm1WWZpOkuJwRTX6+aFr4nLhEga+mQmGdoFkP/66we7eF9dLAZDA5+Q55N26+/FoKvRjFF1xEDiUIFtHXso3XGGLwcenVQCnlyjVerHXwwGFXbA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=DmmPBCzJ; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PcktGpJj; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="DmmPBCzJ"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PcktGpJj" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6227nFjp056160 for ; Mon, 2 Mar 2026 08:00:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= qm+FCCw8m1OMv5Ns4PujjpGalNlRFRIbaokGeVA3Mu0=; b=DmmPBCzJu3VyO1SN wjUcAMCJ102h39ME6280NXmFtyFkJapr95qwwXuADR9wfyaDz5OhyoPZHJypvWgt SedxVIeWxfe3QBXShnLQ0yNo6t3hu5oBxC6xUTxSTL/on6b3UOv/zwE3lLcn0uY2 JrcMNJE0N5TOSmUvZqUJuyPbksZRFz/S1Z44Nb3D7K1wqaa6klBr8n2x8+RRSKcl feXxcoKIoyrZM1R55Gw04M7GZ1H1Qj9KhO9Gq/qHaDRt7NrgswXykBkm44JZizRH 1NIXEjFdB2bHXQQOqQTgKZthVbYR0w8NEctD724F0aov7cmGAdQfzRnMzu+WGKip Pp9zWw== Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4cmw649bfk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 02 Mar 2026 08:00:16 +0000 (GMT) Received: by mail-oi1-f197.google.com with SMTP id 5614622812f47-463a075e0f5so60389009b6e.1 for ; Mon, 02 Mar 2026 00:00:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1772438415; x=1773043215; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=qm+FCCw8m1OMv5Ns4PujjpGalNlRFRIbaokGeVA3Mu0=; b=PcktGpJjz2AyqaBW3sPup/1zEnjco3mNOpAePO2h2Mc2rB7LM9kBz8uJyveeefg7+8 XfFXHWWBhg/7S4WEN3zVoJxzTpfCpQZSV48UC1kt5AEAx1E7JK8IOrj/Gp21ZQ5CiYHz yYNl2bro/TtkISlISTv7mXj4RhuCPExHWcHpaJrUpgwhgh4gklmwn0AOGaMHlx+sqDvn 4MX6NDMlJjmUzuKDRhh4ACElpydlTTdCELZHCYEj4n5bpqRQ6UZPrMuDIxMTei6845Ex 3C7gSKeJ5GrPQzWqhbyOktYBN8Ya6wRoGQD/dZXEjo0+vivB+cd8ckotkncXoKnbaHMQ 0RSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772438415; x=1773043215; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qm+FCCw8m1OMv5Ns4PujjpGalNlRFRIbaokGeVA3Mu0=; b=FKnxB/EqIEbMwuTmjJ3MKuOFxj8yrSmV1YtTnF9p9GQkCScBIXUrjzBMV7J1Aixfq/ naRDbbxzLcaDk1GMIYwM9TwsypwIPC7/kB0hFSkrtckSOvhfdy5nSBbib1OdYNLFC4um pWE0w8GeJdzfaT50AMdv6VRTS7zMg89H6yb3nW01b0K2ljmVop3bpVieVyE3iv8pioXN mgdfpRjZTVypfJrycitDQ/3li3Bpj8PkmKMq3Q4zLs5YH0QIKephrv8R3AXGDG1WJpg9 hjYHFKpOvBprFOOlej/etbRdNzlml4dhVx3mL/kQqCWoQ5ZRmBS9oWisQs0jOBM9TBe9 uQpQ== X-Forwarded-Encrypted: i=1; AJvYcCW0KrjVPT15ItvuAhsLSPTLfNlRQg/wSob7dnptXNFW0B0M4DfL4q+0JV+wvnBZ2JV/HqZRbXKbv7ppnmw=@vger.kernel.org X-Gm-Message-State: AOJu0YxXJTTJTj4E0qmUzs69Qf/Odue27P+z9gRLodA3Rfwq8uBMXEd8 3zltoO5uOtkp/2ATUStxlQkVzuZsvQSLTq7Pwmwn3eNb6XMXxB5S2hqCv0KNeYqaAX0nTb5SOVk epgs6v9Hh3iCeoPiBlY8BicKeuVxTWcImCPnm8dRlZil2YjwFsXd4gABsWh96Ls2uKM4= X-Gm-Gg: ATEYQzyZI9eUdnanhz49zBdLoAJUHDWjvIquPPHpEZRwg1u/x3dh5lt5MjoIL4Wjirb FUI8srHQtZlrHxR4ZAFPVZVS0Ovwl2XP7i2tFcokfLWbo2BzZiOjOsmV8J/6i2wdgykDMjWk+hh 2m0Opykt66TgD22o0+OCB5XKNhNu1nyhwPjnA5OE1l2GEXfD8Idn1NHllUq0Ii0peXC8bpeyErV b/2KALONsD6TU/GnUuFxEAhcpeZv+REx+8PRk7srIHv31SPc4Gk0tmN89KexQi8gcuHzwouh2B0 tG1GDcnghuqScn0DY90ke1isUYFTcSquZU6TX/RnCeLAF23+/5/3EI8qVrF3nx94JSIyhtohR2K EwduG14QKa160kdNDV6szNmVmcurxAPU/ubgalaO/d/XmjrA4JDTuYEFf2v2iaR2QX6wuGAt3X5 +zB6UW X-Received: by 2002:a05:6808:e82:b0:455:eba2:9efa with SMTP id 5614622812f47-464becb5a7dmr5673087b6e.4.1772438415465; Mon, 02 Mar 2026 00:00:15 -0800 (PST) X-Received: by 2002:a05:6808:e82:b0:455:eba2:9efa with SMTP id 5614622812f47-464becb5a7dmr5673064b6e.4.1772438414974; Mon, 02 Mar 2026 00:00:14 -0800 (PST) Received: from hu-ysakshit-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5614622812f47-464bb59ae6csm7159701b6e.11.2026.03.02.00.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2026 00:00:14 -0800 (PST) Date: Mon, 2 Mar 2026 00:00:11 -0800 From: Yuvraj Sakshith To: "David Hildenbrand (Arm)" , Michael Kelley Cc: Michael Kelley , "akpm@linux-foundation.org" , "mst@redhat.com" , "kys@microsoft.com" , "haiyangz@microsoft.com" , "wei.liu@kernel.org" , "decui@microsoft.com" , "longli@microsoft.com" , "jasowang@redhat.com" , "xuanzhuo@linux.alibaba.com" , "eperezma@redhat.com" , "lorenzo.stoakes@oracle.com" , "Liam.Howlett@oracle.com" , "vbabka@suse.cz" , "rppt@kernel.org" , "surenb@google.com" , "mhocko@suse.com" , "jackmanb@google.com" , "hannes@cmpxchg.org" , "ziy@nvidia.com" , "linux-hyperv@vger.kernel.org" , "virtualization@lists.linux.dev" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v1 4/4] page_reporting: change PAGE_REPORTING_DEFAULT_ORDER to -1 Message-ID: References: <20260227140655.360696-1-yuvraj.sakshith@oss.qualcomm.com> <20260227140655.360696-5-yuvraj.sakshith@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Proofpoint-GUID: La9d0Xwx2KeeufCF7l6Cp8TIRgWNVjAw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAyMDA2OSBTYWx0ZWRfX/yKybZV5ZhHo N+QnzeD0taPzRuZwLGwHpoyhQ9PKK2BhT3yG4A38zdIVpC54pAp8ftUfS2N4iKgGRrDY0BKTWww JpmDEBhqJw/Ev8xWqNDATlgG+WS10F648b2ActritUJHv3q9IT6Pjt05wcCd+6twQEuaNXYhkAS bmocELrCSHOiwFxTT9XG5umXMUTEmgSXUGLdPDxX/n5VXYhEHloj9RKc8tP6t850EGoW/bXDlbj HxHwmapQubP3VX0+SSLeChVv5WWgqKLcVOsb4SfabvWXPpgowMeQhcvgYeUSYINi4U1JbRK7+E2 /nh58OKcecepLFwAxNK4g7o+F0JIIZAB+9mDsyvFaGLCxlP3gtB2hevRZFfUjdOVZcp2P2jhsut 5FVDXXHgQDO5SkDbZ2DiQq+VHi4NMbtYp+us/ijdM+TJzOWHACyiTmcNy2n0RPnoC/P3ztrI2qo DFfFJXtIpDdNt3qnrDQ== X-Proofpoint-ORIG-GUID: La9d0Xwx2KeeufCF7l6Cp8TIRgWNVjAw X-Authority-Analysis: v=2.4 cv=I5Vohdgg c=1 sm=1 tr=0 ts=69a54390 cx=c_pps a=WJcna6AvsNCxL/DJwPP1KA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=evlnEj6GgMtUoz0GkIkA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=_Y9Zt4tPzoBS9L09Snn2:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-02_02,2026-02-27_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 phishscore=0 impostorscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603020069 On Mon, Mar 02, 2026 at 08:42:57AM +0100, David Hildenbrand (Arm) wrote: > On 3/2/26 06:25, Michael Kelley wrote: > > From: Yuvraj Sakshith Sent: Sunday, March 1, 2026 7:33 PM > >> > >> On Fri, Feb 27, 2026 at 09:50:15PM +0100, David Hildenbrand (Arm) wrote: > >>> > >>> No need for the (). > >>> > >>> Wondering whether we now also want to do in this patch: > >>> > >>> > >>> diff --git a/mm/page_reporting.c b/mm/page_reporting.c > >>> index f0042d5743af..d432aadf9d07 100644 > >>> --- a/mm/page_reporting.c > >>> +++ b/mm/page_reporting.c > >>> @@ -11,8 +11,7 @@ > >>> #include "page_reporting.h" > >>> #include "internal.h" > >>> > >>> -/* Initialize to an unsupported value */ > >>> -unsigned int page_reporting_order = -1; > >>> +unsigned int page_reporting_order = PAGE_REPORTING_DEFAULT_ORDER; > >>> > >>> static int page_order_update_notify(const char *val, const struct > >>> kernel_param *kp) > >>> { > >>> @@ -369,7 +368,7 @@ int page_reporting_register(struct > >>> page_reporting_dev_info *prdev) > >>> * pageblock_order. > >>> */ > >>> > >>> - if (page_reporting_order == -1) { > >>> + if (page_reporting_order == PAGE_REPORTING_DEFAULT_ORDER) { > >>> > >>> > >> > >> Sure. Now that I think of it, don’t you think the first nested if() will > >> always be false? and can be compressed down to just one if()? > > > > I don't think what you propose is correct. The purpose of testing > > page_reporting_order for -1 is to see if a page reporting order has > > been specified on the kernel boot line. If it has been specified, then > > the page reporting order specified in the call to page_reporting_register() > > [either a specific value or the default] is ignored and the kernel boot > > line value prevails. But if page_reporting_order is -1 here, then > > no kernel boot line value was specified, and the value passed to > > page_reporting_register() should prevail. > > > > With this in mind, substituting PAGE_REPORTING_DEFAULT_ORDER > > for the -1 in the test doesn’t exactly make sense to me. The -1 in the > > test doesn't have quite the same meaning as the -1 for > > PAGE_REPORTING_DEFAULT_ORDER. You could even use -2 for > > the initial value of page_reporting_order, and here in the test, in > > order to make that distinction obvious. Or use a separate symbolic > > name like PAGE_REPORTING_ORDER_NOT_SET. > Option 1: if (page_reporting_order == PAGE_REPORTING_DEFAULT_ORDER) { if (page_reporting_order != PAGE_REPORTING_DEFAULT_ORDER && prdev->order <= MAX_PAGE_ORDER) { page_reporting_order = prdev->order; } else { page_reporting_order = pageblock_order; } } Option 2: if (page_reporting_order == PAGE_REPORTING_ORDER_NOT_SET) { if (page_reporting_order != PAGE_REPORTING_DEFAULT_ORDER && prdev->order <= MAX_PAGE_ORDER) { page_reporting_order = prdev->order; } else { page_reporting_order = pageblock_order; } } > I don't really see a difference between "PAGE_REPORTING_DEFAULT_ORDER" > and "PAGE_REPORTING_ORDER_NOT_SET" that would warrant a split and adding > confusion for the page-reporting drivers. > > In both cases, we want "no special requirement, just use the default". > Maybe we can use a better name to express that. Agreed. If we were to read this code without context, wouldn't it be confusing as to why PAGE_REPORTING_DEFAULT_ORDER is being checked in the first place? Option 1 checks if page_reporting_order is equal to PAGE_REPORTING_DEFAULT_ORDER and then immediately checks if its not equal to it. Which is a bit confusing.. And moreover, page_reporting_order can be set by two people. The commandline and the driver itself. So PAGE_REPORTING_ORDER_NOT_SET can indicate if its set by cmdline and PAGE_REPORTING_DEFAULT_ORDER can be used by drivers exclusively to "tell" page-reporting to select the default value for us. I think what Michael is pointing out is the prevalence of cmdline option over the driver's request. This is not obvious to the reader if we choose to only have one flag IMO :) Thanks, Yuvraj > -- > Cheers, > > David