From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 1740A19C54B for ; Wed, 13 Aug 2025 01:45:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755049502; cv=none; b=GQkU0o0dQVRok+B3DemLDu+3UgOQEA6StBjf7o+kAr17YDn8xspLMOXaWw/yCzzCEZm+LheArSGIzVcxFdeckuRXQBSMSRv69uqL6UefUaQ+t+89jY9uT5y8XigwjfLYUU5rWoXmQZbwHqAT2deOB4hfSEuoJ/3VxIQUyeZ3Wbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755049502; c=relaxed/simple; bh=Ju3IzyV+nwWw8q+CMiCFqvNpGRTMi3k8lIo6iD9B+wU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=SI1KKB9RIVQAsDCwFyLQq72/FmebnQdqdNo2XEr1nKWhoJR8KOeaVVJb9Qxm4ah4lvnJPde9gUF2ooi73GjBY0yBL7yKXxGuECl9+rt0WOMGuFgdd0PVXvIBRr1QDif6GW32fBomxpalICuayj0ElXAcvak5Cx42MitrfDlCgPs= 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=TwZO/Qjo; arc=none smtp.client-ip=95.215.58.186 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="TwZO/Qjo" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1755049488; 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: in-reply-to:in-reply-to:references:references; bh=Ju3IzyV+nwWw8q+CMiCFqvNpGRTMi3k8lIo6iD9B+wU=; b=TwZO/Qjoduloapf+VZQpI0rUDmTFkgAESYLuJYnaWNHEEM+EQaaOnbYY8PGxarfopE7Y94 EINdZ9pz8+M8c8wqcwMip29gm8stLwLlpcMaZrd2kJerqmJakkQlaHXsLDHYMaC3b0XvRr aUiFD+0ONOTF7aFJex9Mmqj+Cgk2SpE= From: Roman Gushchin To: Kuniyuki Iwashima Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Neal Cardwell , Paolo Abeni , Willem de Bruijn , Matthieu Baerts , Mat Martineau , Johannes Weiner , Michal Hocko , Shakeel Butt , Andrew Morton , =?utf-8?Q?Michal_Koutn=C3=BD?= , Tejun Heo , Simon Horman , Geliang Tang , Muchun Song , Mina Almasry , Kuniyuki Iwashima , netdev@vger.kernel.org, mptcp@lists.linux.dev, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 net-next 06/12] net-memcg: Introduce mem_cgroup_from_sk(). In-Reply-To: <20250812175848.512446-7-kuniyu@google.com> (Kuniyuki Iwashima's message of "Tue, 12 Aug 2025 17:58:24 +0000") References: <20250812175848.512446-1-kuniyu@google.com> <20250812175848.512446-7-kuniyu@google.com> Date: Tue, 12 Aug 2025 18:44:36 -0700 Message-ID: <874iucro57.fsf@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT Kuniyuki Iwashima writes: > We will store a flag in the lowest bit of sk->sk_memcg. > > Then, directly dereferencing sk->sk_memcg will be illegal, and we > do not want to allow touching the raw sk->sk_memcg in many places. > > Let's introduce mem_cgroup_from_sk(). > > Other places accessing the raw sk->sk_memcg will be converted later. > > Note that we cannot define the helper as an inline function in > memcontrol.h as we cannot access any fields of struct sock there > due to circular dependency, so it is placed in sock.h. > > Signed-off-by: Kuniyuki Iwashima > Reviewed-by: Eric Dumazet Acked-by: Roman Gushchin