From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [95.215.58.181]) (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 EE5761A681C for ; Wed, 11 Mar 2026 12:21:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773231671; cv=none; b=oVHZpwQ6clOa49hWwvALb9HKWbYStVRkxpmaO3Ek/mNkm6OCxN0mI25cZuUOGa9Ut3kzZlBnrKrSR3Ron38RlpuMXBFN215cg8De+NoWBzulgW+BgAQyeipc2dTFqwncDdHIItkkacUCwZ4aMm533vQ37uDCpzCf6q3/OwJg5us= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773231671; c=relaxed/simple; bh=Cw+/G0xoWB/NbnYjFohAOxNxVrvW9/hzNbIGgyacfgk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=NvTy9xeT2Hlc1d8Jruwi4//GRpCkIyx8FGCYpcAZDJfoh0IAOGr/EmQRk6NlCeoT1MR5vpuAAMp03vEF03g4QzJYueHiTmMfrgY696EKfUF2ZVP3Wrjed6BbIuQWCPbmLNO6MoO2HKcEFCEBmyXAAbq2hgT8xaPY3IfoeRH/7BA= 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=YgE9Egj1; arc=none smtp.client-ip=95.215.58.181 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="YgE9Egj1" Message-ID: <9d65fd6b-74a1-46ea-b6f8-20d17c5ddc68@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1773231666; 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=Ee/r1vRJT9+5mrJU24WjXO3pAsTS+UTnfUyMaErY2pA=; b=YgE9Egj1HJYxtbIDkkh04xxk1q4I93281lGhh41lGiLT9HrHb1uWRdN9cz1G6xz3DtwzHk 726JNfDtkVPR0NoJJDaACGTsMmj45+lAzxuyV8fqZN13tpK5qJwC2PSFT1BoE+msU9TZ5R jiRNTryf2gaVMsTxuo2kZ5qkXiZFzh8= Date: Wed, 11 Mar 2026 20:20:54 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v6 3/4] mm: huge_memory: refactor enabled_store() with change_enabled() Content-Language: en-US To: Breno Leitao Cc: linux-mm@kvack.org, Baolin Wang , Barry Song , Ryan Roberts , Michal Hocko , Vlastimil Babka , Suren Baghdasaryan , Zi Yan , Johannes Weiner , David Hildenbrand , "Liam R. Howlett" , Andrew Morton , Mike Rapoport , linux-kernel@vger.kernel.org, Brendan Jackman , usamaarif642@gmail.com, kas@kernel.org, kernel-team@meta.com, "Lorenzo Stoakes (Oracle)" , Wei Yang , Dev Jain , Nico Pache , Lorenzo Stoakes References: <20260311-thp_logs-v6-0-421e30d881e0@debian.org> <20260311-thp_logs-v6-3-421e30d881e0@debian.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: <20260311-thp_logs-v6-3-421e30d881e0@debian.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2026/3/11 18:17, Breno Leitao wrote: > Refactor enabled_store() to use a new change_enabled() helper. > Introduce a separate enum global_enabled_mode and > global_enabled_mode_strings[], mirroring the anon_enabled_mode > pattern from the previous commit. > > A separate enum is necessary because the global THP setting does > not support "inherit", only "always", "madvise", and "never". > Reusing anon_enabled_mode would leave a NULL gap in the string > array, causing sysfs_match_string() to stop early and fail to > match entries after the gap. > > The helper uses the same loop pattern as set_anon_enabled_mode(), > iterating over an array of flag bit positions and using > __test_and_set_bit()/__test_and_clear_bit() to track whether the state > actually changed. > > Reviewed-by: Lorenzo Stoakes (Oracle) > Reviewed-by: Zi Yan > Reviewed-by: Baolin Wang > Reviewed-by: Wei Yang > Signed-off-by: Breno Leitao > --- Thanks! Tested-by: Lance Yang