From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (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 7050C3DB99C for ; Thu, 14 May 2026 08:33:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778747624; cv=none; b=bqn+M8xAz018U8c5vkm0WszC2KnVCUW6KVYz9/yotOCq3mub4svv8RPLWO5kvIejLKbqc/b2GHFHGuDpXGTlk+vtyYjx8IJ0cirZle7n7ttIiUT0xTNdgWjp3l93KEz8+ohFnVhKPKJ+iQOTCh3thK4RCYPRA/+M+yZm6d6Sggo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778747624; c=relaxed/simple; bh=F6JP4FS6PGmfzF49UzikYCNXBvpBZzidnrUVetXfC+4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y3+jLJuGm/OhdfZtDqmfpEhcNycaEtiqFho3MeD2jrKhjhKPjcDEonnQc4fj8lY30gScrfisZcJldHpLJitI1HNXe0R/K2sqUrOW3xKEswvC+LGyhaESCCGonuDAQMgYBxlwZQB25cgG8vZzOBEjZDaWOGTpkr+8iRqV08Mp870= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=s+I7jphZ; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="s+I7jphZ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=3MsbT6y0QkRMCsQwhjQy5RNV8DfFy7/Kf2n33VVPWmc=; b=s+I7jphZie5b0/huV3ZBUqsNj+ XOMpxJ63W3/wS7OhOg68xWq4trwajG2+2SxNAIjlSMn7huVEcUTAuhhGZCwzFzpSyFgVz7kgaGPG1 DbJ/snCgeCGs4Kzs075GWbojx2Ng2QEUn2909lgPW6A+X1zOl6cmdE/97bqKRCW/sFQWaKV1a5QDi F7EfRTScMazQOdLZYxoJq7/ufnSyJ0MMlIcSuEheR52jeMCZJt0ofkSST+mgcrbENH2Rkk8jTE0qN yGGBh5KKjDAHDYGpYHEjrTkForFNsa6nItSb29qgRazK/hcjl+lHZ6YTCz9NbP+IHV30DOT3qeKCo Ju4YIgpw==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wNRVM-003oLL-2Y; Thu, 14 May 2026 08:33:17 +0000 Date: Thu, 14 May 2026 01:33:11 -0700 From: Breno Leitao To: ranxiaokai627@163.com Cc: hughd@google.com, baolin.wang@linux.alibaba.com, akpm@linux-foundation.org, ljs@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ran.xiaokai@zte.com.cn Subject: Re: [PATCH v2 1/2] mm: huge_memory: refactor thpsize_shmem_enabled_store() with sysfs_match_string() Message-ID: References: <20260513094508.50888-1-ranxiaokai627@163.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=us-ascii Content-Disposition: inline In-Reply-To: <20260513094508.50888-1-ranxiaokai627@163.com> X-Debian-User: leitao On Wed, May 13, 2026 at 09:45:07AM +0000, ranxiaokai627@163.com wrote: > From: Ran Xiaokai > > Inspired by commit 82d9ff648c6c ("mm: huge_memory: refactor > anon_enabled_store() with set_anon_enabled_mode()"), refactor > thpsize_shmem_enabled_store() using sysfs_match_string(). > This eliminates the duplicated spin_lock/unlock(), set/clear_bit(), > calls across all branches, reducing code duplication. > > Tested with selftests ./run_kselftest.sh -t mm:ksft_thp.sh, > all test cases passed. > > Signed-off-by: Ran Xiaokai Reviewed-by: Breno Leitao > + /* Do not override huge allocation policy with non-PMD sized mTHP */ > + if (mode == HUGE_SHMEM_ENABLED_INHERIT && > + shmem_huge == SHMEM_HUGE_FORCE && !is_pmd_order(order)) > + return -EINVAL; This identation seems a bit broken. You probably want something like: if (mode == HUGE_SHMEM_ENABLED_INHERIT && shmem_huge == SHMEM_HUGE_FORCE && !is_pmd_order(order)) return -EINVAL;