From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E5C8CDB483 for ; Wed, 18 Oct 2023 14:05:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344827AbjJROFH (ORCPT ); Wed, 18 Oct 2023 10:05:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231839AbjJROFF (ORCPT ); Wed, 18 Oct 2023 10:05:05 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3131DFA; Wed, 18 Oct 2023 07:05:02 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6910B1F37E; Wed, 18 Oct 2023 14:05:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1697637900; h=from:from:reply-to: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=SsQxhsXnIr7Z2WAF9+fEfFsGy8r27zDk+QEwu45RAUk=; b=sejrAI/b+RIgxvnafZx2UdISVWeL4WV4kK2U0+73bXZmNEFuf97rkRxmhJNb18Kl1WVy2f 62gnNaKpLr/yKnh/ajACEPKdOeki4gwyUy3uHkk2fDnePOFhIsbge9nL3MciNrxwzuvroj y3eEGo2OXOqIG5ZJ512UIlKLWvqfKAQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1697637900; h=from:from:reply-to: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=SsQxhsXnIr7Z2WAF9+fEfFsGy8r27zDk+QEwu45RAUk=; b=BK+welAkUKNdlp0QjigqX8KEnJeqAMCwSQ5RmlN6vlFGv1tGoX7YdfTPO0us9cKgD5v397 VtdaZvTOdWS1pXDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2F0DF13915; Wed, 18 Oct 2023 14:05:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XqHnCgzmL2VUTAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 14:05:00 +0000 Message-ID: <549f20e0-d0d7-b379-6725-4f76dddcd6fc@suse.cz> Date: Wed, 18 Oct 2023 16:04:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v3 4/5] mm: kmem: scoped objcg protection Content-Language: en-US To: Roman Gushchin , Andrew Morton Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Johannes Weiner , Michal Hocko , shakeelb@google.com, Muchun Song , Dennis Zhou , David Rientjes , Naresh Kamboju References: <20231016221900.4031141-1-roman.gushchin@linux.dev> <20231016221900.4031141-5-roman.gushchin@linux.dev> From: Vlastimil Babka In-Reply-To: <20231016221900.4031141-5-roman.gushchin@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [-5.99 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-1.89)[94.38%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[11]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/17/23 00:18, Roman Gushchin wrote: > Switch to a scope-based protection of the objcg pointer on slab/kmem > allocation paths. Instead of using the get_() semantics in the > pre-allocation hook and put the reference afterwards, let's rely > on the fact that objcg is pinned by the scope. > > It's possible because: > 1) if the objcg is received from the current task struct, the task is > keeping a reference to the objcg. > 2) if the objcg is received from an active memcg (remote charging), > the memcg is pinned by the scope and has a reference to the > corresponding objcg. > > Signed-off-by: Roman Gushchin (Cruise) > Tested-by: Naresh Kamboju > Acked-by: Shakeel Butt Reviewed-by: Vlastimil Babka