Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2110051imm; Fri, 7 Sep 2018 10:56:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYVc2hYOJqr9InJBQvrzM/vnfe43PqRSENK/fG01Kem/5z83JNuOnf7xt1zfeSpEW5EDOI2 X-Received: by 2002:a63:8e4a:: with SMTP id k71-v6mr9447319pge.45.1536343002466; Fri, 07 Sep 2018 10:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536343002; cv=none; d=google.com; s=arc-20160816; b=jR79Tc+AvMi/zkDuo6pmvaTcX/BRRZNbv2Vu5YeGdDY3KyslcTc4vOHIXN3fqoHuBm bpO4k/KFjVF8ZJS/HtOcxGtj7eUxlhWpYLZZijaBOSbFp1WfNlJWYll8u2I4xRRsu45p EjDBjaj9cusg7fec5VkAypmmuS+CWF9KpHGKyXUh9eYE+C4uOguluCzR9eVprdV3bQmf N8lPGBLxN7lSol/wOmmifMgSiK3lFS+kY9VuILxfgXuq8nIVM1djgnipIleyPpdvwHnN hHfUFE1RKbF+haXUNpDxhx4L2zkCrrzU3uoPlffEbLMJ/HeWYHd+u6SD7NHjJ5Icdnfd 7Q4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Sw6pbXe12wkIIY0DzSGDBgpk/O0ujeodMCZZAv1/1Sw=; b=yXBJaLT5K3yZGQv0nOJmtp66GJHbzojIlhl+jeHQ0+lGX14T+dbd8DcM5icasnkgDj S2jXdG4KBY3c/QfqTEJs5ChJu1hDAPpBf3kZHdimuTpmxwyh6t++9MC2/qdJtC0Tmu2T 2RX5IH8vE+ZkLElf7A5QtsZxLiW1JtD5XpOqu9S2qSrjtgOrt7rR+RceovVnYT+eVcd8 T459Ck2auQ60q95uRv2NdpuPS10PuQebVROyn14z8KiAT0NNaophrn3qZjoqy4BFvj4I avdffUQ0EZI/I6+tSi1Jvc9YnRyH6KgAMqR8KyKINw+VGNAIylZv+gbQIihefG8U9X9k GInQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ul74lg4S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v132-v6si9283747pfc.193.2018.09.07.10.56.27; Fri, 07 Sep 2018 10:56:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ul74lg4S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbeIGWgx (ORCPT + 99 others); Fri, 7 Sep 2018 18:36:53 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:46196 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726583AbeIGWgx (ORCPT ); Fri, 7 Sep 2018 18:36:53 -0400 Received: by mail-yw1-f67.google.com with SMTP id j131-v6so5671787ywc.13; Fri, 07 Sep 2018 10:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Sw6pbXe12wkIIY0DzSGDBgpk/O0ujeodMCZZAv1/1Sw=; b=ul74lg4S8XSunuW2s7t7cf5hyFrSzALM2HfiwHA82ivrRjJZOFJhBmq57+rIzygep8 39PEdeWyjkEPTR2FPJVoLwYPYaXFEnhcQljCJQKHMu6MMALcv5+Gq5zRmKj75MtyJ/HY SacvqAEcstmSkYY7SGnRQEbOOPqQax4bgYYLmH2EXvDB1+MdkS68bMzAfY0uiLiFF89N tVzpfbwGZTWZa/aKrdKjn3ekedMpzZVaUXYexCKepHDgXMhS91Jlo3vM/lRvxd0DFsYl ibc06GgrMOjvXz1cD5SPaDGpQZeJxHgE7rqrep09c2RWPa6WV3wenCCKuidRbq8QqAMB QPTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Sw6pbXe12wkIIY0DzSGDBgpk/O0ujeodMCZZAv1/1Sw=; b=tmnzDUsoHhCNDPkjeUIsLBstPxkRtJkRD4xC/1m56GfSnQ+E/5f26fchOvMVPzHH/2 Nb4tElWH+VGT7QMJAU7CidhddmSdBMMiVAOgjQ/L3i9kP1N4c+WHM4pzBpwVO+RRgbh+ nJviG+USSiGTvvZ0P7OqylzNBCNLBM44M8y9tCxcstkx7SwZjc5748JNqkWX5Dij3C7l w5qZh2XV38MY2lbAXhB81VL/ORvsvWX31wuFzbSXfGEZWW4v2MTf6eLlJeZgu6NupGcU Y2IakOd253b+eHNmAzjoeOJt8Cig1QVjzl0ob9PQKE6lU/SemjFAsc/RSgy4jNiMA3Wr 3wmA== X-Gm-Message-State: APzg51DQDoVckBqqbdQYQqYwb9uztWE3yH3bmENuKm5FMDeLj8F8SZgF zg32ig8FXFsWwgTUbWnrtjI= X-Received: by 2002:a0d:da01:: with SMTP id c1-v6mr4692723ywe.346.1536342889660; Fri, 07 Sep 2018 10:54:49 -0700 (PDT) Received: from localhost ([2620:10d:c091:180::1:70a9]) by smtp.gmail.com with ESMTPSA id r3-v6sm5211449ywr.80.2018.09.07.10.54.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 10:54:48 -0700 (PDT) Date: Fri, 7 Sep 2018 10:54:46 -0700 From: Tejun Heo To: Dennis Zhou Cc: Jens Axboe , Johannes Weiner , Josef Bacik , kernel-team@fb.com, linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/12] blkcg: remove additional reference to the css Message-ID: <20180907175446.GC1100574@devbig004.ftw2.facebook.com> References: <20180906211045.29055-1-dennisszhou@gmail.com> <20180906211045.29055-10-dennisszhou@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180906211045.29055-10-dennisszhou@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Thu, Sep 06, 2018 at 05:10:42PM -0400, Dennis Zhou wrote: > +struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgrp, > + struct cgroup_subsys *ss) > +{ > + struct cgroup_subsys_state *css; > + > + rcu_read_lock(); > + > + do { > + css = cgroup_css(cgrp, ss); > + > + if (css) > + goto out_unlock; > + cgrp = cgroup_parent(cgrp); > + } while (cgrp); > + > + css = init_css_set.subsys[ss->id]; > +out_unlock: > + rcu_read_unlock(); Nothing protects @css here tho. It can be released before the caller is done with it. The caller must ensure that it's holding rcu read lock to protect the lookup and the subsequent uses. cgroup_css() already checks for rcu locking, so if you just drop rcu_read_lock/unlock(), everything should work fine. Thanks. -- tejun