Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2088095rdb; Tue, 3 Oct 2023 09:48:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETRx02K2U3aEsOZf4VBQibWAQTtDhz8L+M7vqSJ8jZGvwlwVh0RSCtIDx2dWStEtVNN75u X-Received: by 2002:a17:902:ba8c:b0:1c6:28f6:954a with SMTP id k12-20020a170902ba8c00b001c628f6954amr131726pls.64.1696351727042; Tue, 03 Oct 2023 09:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696351727; cv=none; d=google.com; s=arc-20160816; b=L3iiRInRQ8uyWPmFbsAyE8wRt8yGpH2f7Ru9o7UGd/v7AkQE4OCB9RlT1dgAqV8V0V 1oq8J36gfXdxjNfTZ5PlznN+F3Tt6+TdVYThqAav1XLnlKp9cMDT5C42X7hOOxsiQbZk LdYDRSTHutoLmGuElXjifl41Ro+Q8H4++ZB496YuYexVw8CC65aiw2U0HN6+qLF8SGpb kIYnR8jc57h3KNJi2I8NBN8ebo4vgjI1GWvIIbV6R0fJTpCh9+DbsDvonamKArwl7sL3 q1vZQKUTqC92xu97yFD/BKOwEuyS2kFMocpbJtrtJtnAMJHSpva06tWjIkyvcYhxpBVc qwMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7fQqegtPGr2l/qfGLLeKHAsEgJgKMskDcYWjAE5QgNs=; fh=+ASGX5bw915Wm/PW1852nWdQy8mLoUgABbrJJihd0PI=; b=i//S6c6+j7KfPddoMirad1ck2vrwqTVjRhFObiXlLMmqlX95IWjTQ2B6ni65K7UKV6 aEH2awFdq24ASX4e7qgvBMG22IVXctF0qL0zyimrcHSc+hfCeLt/tf2pn58B+/W63Cfo YwzkC92vjzWad1U6mBNi9Iwz4NfjcGzW+Dp6wkid4/7pWpvSmrB+L/PG4XlJq12kYLof sgBtyswQhzY19yb18QUVAxqya3bcaIwK8xzR8NK+j2iqK/giPl0VMQJ0WHOJ2IWK53vB Ui3N0A+erayHL/H0oacLfYBv9UNWAGMkA3yncBbLqELXnYn0MAg4MgJn1leNbGej9MIK b7BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=gVKov6mP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id m12-20020a170902e40c00b001c754e83e06si1691760ple.164.2023.10.03.09.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 09:48:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=gVKov6mP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 111348131A91; Tue, 3 Oct 2023 09:48:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240463AbjJCQsq (ORCPT + 99 others); Tue, 3 Oct 2023 12:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240491AbjJCQso (ORCPT ); Tue, 3 Oct 2023 12:48:44 -0400 Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0457BB4 for ; Tue, 3 Oct 2023 09:48:37 -0700 (PDT) Received: by mail-vk1-xa2f.google.com with SMTP id 71dfb90a1353d-495eb6e2b80so511946e0c.1 for ; Tue, 03 Oct 2023 09:48:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1696351716; x=1696956516; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7fQqegtPGr2l/qfGLLeKHAsEgJgKMskDcYWjAE5QgNs=; b=gVKov6mPeAcopJtqLwZsXvaTj9WR0vDK2+KkquuE/SjYdRn1jSZzwvo3S2upYQ3YXP fF7RnI3OWo63osg1t7KQ2L2EibfLTAQEs+NgBCiIM/MAk4FYyjsxGxSmo0aAkOBxf/3K NrGgY0UunZZNfEyVcE0wFUZTMjs/ldNGMRf2EZGgJVr9FvMrhEl+ceE1eNyCQYRUVG/v tnSqY6ElKdByFadA9Y2iHAr3p2Hgl2ZwzjzlvaA3LIURF7mKZgTN5O+iTNFtW/EmWbla dixOHshXditOZwGRzylht4pMObof4vwtsyaIHqYh1TDurtciDJak9FG+l+WisyxvPbXZ D8ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696351716; x=1696956516; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7fQqegtPGr2l/qfGLLeKHAsEgJgKMskDcYWjAE5QgNs=; b=gVe8XX6398m+pZZEv3ZXP5NGH0twaxj3wzcGSJnvKPqJMBep9W3b2WJxykrqGWHCld MfVRjjB8FyD+OvYa4aVi2Y0QClL0eNfAQRAzU5cvrTRx/YJgajVZH2p4ZYRV04wqkcNZ iSn3iBlX0AkwgTjY2hpC5iKmfnKs/vM77abg6dkZpCFCBGouZp+MmcEtI8eEyTGV7Us1 3oKSibgWS+lY5fO07KVQ8r4hvXsuqLKMi+H38tWKGYQtg4LIOGJqEbFh5vs4alvXzsyQ jFJqbLU2ShthXovKL37Bxg6kX3PwBlQ8n/f8EGSH2a6khqS1G9YD0ejJlkoIaSMEA/Kw 6JAg== X-Gm-Message-State: AOJu0YzMCBG7PDkaAoDfWSkPa01/OQmP1zuF6uT3RnZpQHp9e9RfCBtz R+7HkU2LUhJBAN+zQQhmhQOs0EuXxJ9XRmpawGs= X-Received: by 2002:a1f:e043:0:b0:490:b58e:75a9 with SMTP id x64-20020a1fe043000000b00490b58e75a9mr10316947vkg.4.1696351716094; Tue, 03 Oct 2023 09:48:36 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:753d]) by smtp.gmail.com with ESMTPSA id g12-20020ac8480c000000b00415268abe26sm570941qtq.8.2023.10.03.09.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 09:48:35 -0700 (PDT) Date: Tue, 3 Oct 2023 12:48:35 -0400 From: Johannes Weiner To: Roman Gushchin Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Michal Hocko , Shakeel Butt , Muchun Song , Dennis Zhou , Andrew Morton , David Rientjes , Vlastimil Babka Subject: Re: [PATCH v1 1/5] mm: kmem: optimize get_obj_cgroup_from_current() Message-ID: <20231003164835.GA20979@cmpxchg.org> References: <20230929180056.1122002-1-roman.gushchin@linux.dev> <20230929180056.1122002-2-roman.gushchin@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230929180056.1122002-2-roman.gushchin@linux.dev> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 03 Oct 2023 09:48:46 -0700 (PDT) On Fri, Sep 29, 2023 at 11:00:51AM -0700, Roman Gushchin wrote: > Manually inline memcg_kmem_bypass() and active_memcg() to speed up > get_obj_cgroup_from_current() by avoiding duplicate in_task() checks > and active_memcg() readings. > > Also add a likely() macro to __get_obj_cgroup_from_memcg(): > obj_cgroup_tryget() should succeed at almost all times except a very > unlikely race with the memcg deletion path. > > Signed-off-by: Roman Gushchin (Cruise) > Acked-by: Shakeel Butt Acked-by: Johannes Weiner