From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (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 B8B1F3DB970 for ; Thu, 21 May 2026 13:18:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779369492; cv=none; b=eTVWmqfQyNwM8E+lgxDU9F1bzwwmKpyr/dCqmMJfNatYkc0VDORyIhNBzuwOrHmgBu3Xr1tE5MGeKTbjCyMPcDprYjSBmBrtKxLnyOiUXsPwN6CLvcaZ8fUy176Mgj3eoxP4BhsHppdOg5jiYXXAN6bVjN2Mp8ZILrszftsniZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779369492; c=relaxed/simple; bh=yl6Lt2rRDt7hqeRjWXhMgOTzAouGO7C12Qs9oC7Jb+0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gQ/XAVeDwDzvFY1yrDOxA49kCyNBm36d2eRAs91scRaiRkp0PrUfgL0kyXhX9pe/mdPPsk+nJ/4hviPazoPN60BHI2q6uxNi84kmjMdqCWYptEsEgqkFMae3AkGguW0L9rv7xCwXvYWq6O40p5ZzsKABBmh2+knALFF1wYIUzcI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=m8dK+X2H; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="m8dK+X2H" Message-ID: <6a5a87f5-4f01-4b49-abdc-130165463d6c@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779369488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MGlW8OhXAGKNCm5ixrBnlcHP1gUwh/mnEV1I5l7eHu4=; b=m8dK+X2Hlp1M7QXFezf6ppAphPTq/paZieXtIi/Zjmfb3X+IzPcaTh/Er+TjqUv3VBrUMa CZkWXRNiKNmtGGzDnNhFLmiNM/hkyqvZ8dozNXkGcXBLmL1DoP6FWdK/ju6X5a9QSrAe9A f7pWpYwuGXCtY6Lzq1qPrhujv/AK6YI= Date: Thu, 21 May 2026 21:17:40 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v3 1/2] mm: shmem: refactor thpsize_shmem_enabled_store() with sysfs_match_string() To: ranxiaokai627@163.com Cc: leitao@debian.org, ljs@kernel.org, ziy@nvidia.com, liam@infradead.org, npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com, hughd@google.com, baohua@kernel.org, david@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ran.xiaokai@zte.com.cn, baolin.wang@linux.alibaba.com, akpm@linux-foundation.org References: <20260518123238.56344-1-ranxiaokai627@163.com> <20260518123238.56344-2-ranxiaokai627@163.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <20260518123238.56344-2-ranxiaokai627@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2026/5/18 20:32, 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. > > Behavioral change: > Call start_stop_khugepaged() only when the mode actually changes. > If unchanged, call set_recommended_min_free_kbytes() to preserve > legacy watermark behavior. This avoids unnecessary khugepaged restarts. > > Tested with selftests ./run_kselftest.sh -t mm:ksft_thp.sh, > all test cases passed. > > Signed-off-by: Ran Xiaokai > --- Thanks. Tested-by: Lance Yang