From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (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 54DCA3C2BA4 for ; Thu, 25 Jun 2026 10:06:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782382000; cv=none; b=d9jSjGpumQgY4iV2HnXWoEad6MK417CoR3orU1oSGoJQPzKCoD+IS5AM4imSCSkxIj2aywKnjdLJp3glB2kd3MwygcpRXUO3Wi87H8Xgb7R+q9rui5e15kJewHi7z7FQbjT/jxg9/ANQup6m8e8iBQwZ0NMDXdoPwL96owaltTI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782382000; c=relaxed/simple; bh=ANa8IcjPykaV54B8EsDsVUEYuOH2MxyA20mNnsU867A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=k3H8dOs+IQuuWwvoE8IhirhYXACAsy7pC+a2Je5Vq7c9EXBDb7IFF1oehYGnn+h5gupATAFXokvJWZZRt8ttwTjP0DK6+kEWePngQlTCRIgw+ba39vPyXVdRSqe6Jp6aHnU0Mm5ddNRs02xw5GKihIcTREGl0QxHIo1KxBpPOnc= 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=VSassdhd; arc=none smtp.client-ip=91.218.175.177 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="VSassdhd" Message-ID: <349795fa-79c4-4b52-af2d-293138fba4e0@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782381995; 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=yWbZwk6nLyJmAjVVXNOjovGBWPmjhIM8DxEL4Q+fXdM=; b=VSassdhdo9VpoSveN5qZAucMqvhSECqhAg5f9HlNeegFbPE0T4mK47n9iMb2+Ows0FNStK Z1MlESkorg3vaF1eG99y7b7uzVMqbM6RigrW+nohma951GXy9Ln9TLIcqyv0k9A7Xh86WK 3OB89JPjqP7ijJ5vZVir0F2eHc2x4Fw= Date: Thu, 25 Jun 2026 11:06:06 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 2/2] mm/vmpressure: split v1 userspace eventfd code into vmpressure-v1.c To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: Andrew Morton , david@kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, tj@kernel.org, shakeel.butt@linux.dev, roman.gushchin@linux.dev, liam@infradead.org, linux-kernel@vger.kernel.org, ljs@kernel.org, mhocko@suse.com, rppt@kernel.org, surenb@google.com, vbabka@kernel.org, kernel-team@meta.com References: <20260606114158.3126210-1-usama.arif@linux.dev> <20260606114158.3126210-3-usama.arif@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Usama Arif In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 25/06/2026 10:00, Michal Koutný wrote: > On Sat, Jun 06, 2026 at 04:41:34AM -0700, Usama Arif wrote: >> Clean up mm/vmpressure.c by separating the cgroup v1 userspace eventfd >> interface from the shared and v2 in-kernel code. >> >> Currently, almost half of mm/vmpressure.c exists to serve tree=true: >> struct vmpressure_event, the events list and its mutex, the work_struct >> and vmpressure_work_fn that drains tree_scanned/tree_reclaimed, the >> parent walk, vmpressure_event(), vmpressure_register_event(), >> vmpressure_unregister_event(), and vmpressure_prio() (which always >> calls vmpressure() with tree=true). >> >> Move it all into a new mm/vmpressure-v1.c built only when >> CONFIG_MEMCG_V1=y (following the existing memcontrol-v1.o pattern). > > Thanks for this dissection. > >> @@ -283,14 +152,8 @@ void vmpressure(gfp_t gfp, int order, struct mem_cgroup *memcg, bool tree, >> return; >> >> if (tree) { >> - spin_lock(&vmpr->sr_lock); >> - scanned = vmpr->tree_scanned += scanned; >> - vmpr->tree_reclaimed += reclaimed; >> - spin_unlock(&vmpr->sr_lock); >> - >> - if (scanned < vmpressure_win) >> - return; >> - schedule_work(&vmpr->work); >> + vmpressure_v1_account_tree(vmpr, scanned, reclaimed); >> + return; >> } else { >> enum vmpressure_levels level; >> > > This return; looks weird, I'd either > a) drop it or > b) keep it + de-indent the rest of the vmpressure(). Thanks! Will do.