From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 A1C81288C08 for ; Fri, 6 Feb 2026 15:29:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770391757; cv=none; b=fzX1f/fBsBpGoVReaauzRkO2yJ4eV3wH9ZBSiDXC+WD6ZDiHEHQAzvVpeokNSnrsnsStldEdm6evXWsUiJGZEw4XRH8+SffqwdRsq75lNRchI4XLcbJrNfn/eTV6Ka/cNonBS/sf6MY0JqAaV0zy9GCoTH84pVyWHwCnxZgYZxM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770391757; c=relaxed/simple; bh=BXz/RBzw/17K+5a/ZGF38NqB78xQdhLxxyW5A2+gGgU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o+9HGm8x4LhPw9JUV+PZRn27DdEW28FQH+4EyhDEDDBNPrFMxg+AIA/LBNjWjfKJmFJCwi3CG2GlHnpAgjDQUjzda8bNxRDwOQm3bZcFdyu8fIoba8jF8Ya36H+0jaq6xqOCM6Pw9oumTgqOWDHgJTsEmaObt8qqxQBcaVBA0Rk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=m5INnH5Z; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="m5INnH5Z" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AVUop78ux91cHyjHUfguhbbjHSQTp88xnWvceiJRFLU=; b=m5INnH5ZnhfPYYArkaPSoRjEVh 4N46sjbuTj/NJTBffuAyHjahVfHjHwPxqs9xsKjiDJ93ymlkOYxeW5zjGllWxGXLxttZx/pDHdHus 3G9tXXoA7o57DwEpwnJeInxVGE7zPbB9w/uuYWX72BNiYd04+XEFBzdMSn3FpsNFrf3nrihKqjPcu w97WSSM18X4OvIpS7DNI9JR+v25D66+vmoYbkEZxtexQGi3Eu15715q1lWJi6bw2HUNnaEcJZlPF6 ZRcDqA2OK+oq4K3sCL2qsA5+ZCf1DVCIXDc+02JsSS/FXLaDZQcyWIEX1A8lFalLeURFMRUNG8OvI bYp8Yn2g==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1voNlb-00000005Ozj-3NPX; Fri, 06 Feb 2026 15:29:07 +0000 Date: Fri, 6 Feb 2026 15:29:07 +0000 From: Matthew Wilcox To: xu.xin16@zte.com.cn Cc: david@kernel.org, akpm@linux-foundation.org, chengming.zhou@linux.dev, hughd@google.com, wang.yaxin@zte.com.cn, yang.yang29@zte.com.cn, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: ksm: initialize rmap values directly and make them const Message-ID: References: <202602061522548871ohgXN8z0qq87sTSX-yZc@zte.com.cn> 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=us-ascii Content-Disposition: inline In-Reply-To: <202602061522548871ohgXN8z0qq87sTSX-yZc@zte.com.cn> On Fri, Feb 06, 2026 at 03:22:54PM +0800, xu.xin16@zte.com.cn wrote: > make them const to make code more robust. Besides, since KSM folios are always > order-0, so folio_nr_pages(KSM folio) is always 1, so the line: > > "pgoff_end = pgoff_start + folio_nr_pages(folio) - 1;" > > becomes directly: > > "pgoff_end = pgoff_start;" How do you know KSM folios will always be order 0? I don't. NAK this change.