From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5720F1F03D9 for ; Tue, 16 Dec 2025 19:36:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765913780; cv=none; b=blDjfgVKLt4KGLfjUuiIDoiYQOOSl8DKs3U0OjWNsm625JqDAp2QmNyu3vWa2lbADj4Yj4NQ8raQ2s+AnPfQv++u74xu6IDkY+94bbeZAi4pqq+1JdA6QzRI4CoU3d3DkBm//wTOiYm2hXqOuMFdPgcgVlPhVIaiHvPfWlrR6Rc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765913780; c=relaxed/simple; bh=2K26rkSUzZxc0jEUoJEjhk6f8rAR6pwlNtCTHpXwVzo=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Idi6XKW450JdiuADSsMHe7mtYxofDfi1CFHhnFTphmE1LHY3LYQNwsbwOZd7+6hMQo5alA5eo80jSJGDvPm+KZy/02edvJU9dw6iXA3LotW6ypHLnMkbbMoPSgFT8/u9xD2cMjVE0KhNRnV3uwGiV146ag34FqtYYt6s4KQ9yyY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=lFRcUpua; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="lFRcUpua" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E4C8C4CEF1; Tue, 16 Dec 2025 19:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1765913779; bh=2K26rkSUzZxc0jEUoJEjhk6f8rAR6pwlNtCTHpXwVzo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lFRcUpuaa/yujv/rq5gyQ1Hov3D2+xFdJN5QtCQeKgCDD0/TJQHgvH6lgRVse3BhG 6fXEzyZwOrMrol1J00f7EIcmLaO0x3cfewrAFshWMcY3X/2m9HoKf4HbraxN5b2Icm ychdAgwK4a73M8jZQb43hBTBJM2Yv2/FpWGJVphk= Date: Tue, 16 Dec 2025 11:36:19 -0800 From: Andrew Morton To: Anshuman Khandual Cc: Weilin Tong , Hugh Dickins , Baolin Wang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/shmem: add mTHP swpout fallback statistics in shmem_writeout() Message-Id: <20251216113619.af93c4c37f8e880a14516a2f@linux-foundation.org> In-Reply-To: <3c86d612-aab7-4e80-bc6a-3ccf2bab9c34@arm.com> References: <20251215024632.250149-1-tongweilin@linux.alibaba.com> <3c86d612-aab7-4e80-bc6a-3ccf2bab9c34@arm.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Tue, 16 Dec 2025 12:04:02 +0530 Anshuman Khandual wrote: > > --- a/mm/shmem.c > > +++ b/mm/shmem.c > > @@ -1593,11 +1593,23 @@ int shmem_writeout(struct folio *folio, struct swap_iocb **plug, > > } > > > > if (split) { > > + int order; > > + > > Could this be moved up near the 'nr_pages' declaration instead ? It could, but I think it's good practice to restrict the scope of things to "no more than necessary"?