Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2259981imm; Fri, 7 Sep 2018 13:26:01 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZw8shOoUvnOLgViAxG9qEvyxcyurJuqGdzM9Uebx9MF2Jsjxei0EU1IqheC8elFmLckzaH X-Received: by 2002:a63:5a13:: with SMTP id o19-v6mr9972669pgb.75.1536351961544; Fri, 07 Sep 2018 13:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536351961; cv=none; d=google.com; s=arc-20160816; b=LOw4KF7la05l0Cwz8T9T9ibd2Jt3r7EuxOMfS0LJOILXzfH/SSwI8XrbqJZpVYiODF egVaVwD1WQBccB3M5pRBpOgtHTstyF1BrrN0XSTbZ5IaF5UlD2ONM6SpyDEHokpNmpME Sc+aAh4rds8ac9fDNfU5Ee61SlzPTn4iC47J4M7NoQzeXnCeNapXfOQpyu7hDYO5p0kV YbyuhPvy04Xw9q92+gxhwcwQmqBtMtD/XnIxJ6TnulmLs0rXj93davPw4dT49fefngZK kV7txFWe3tw26nqhcHRldAJokIfJZOrz70FdirDNW8HfL85PWdf3vhC2Eg8Hrl+bHSKZ xXdA== 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=9Be7dN/R3NmgXTLGeqjDknniy0VbvWrwupfeyuN8MtY=; b=Qml1U91rKBgoqP1PhVYBFlpBXZ+KapV5KhHwtzGaGs1vxa+D26SFC4GXr+cQBTyE6f L1CeAMhmT6OHtqtN1Zj3kzsHaEj1nYyP9lybRgSL9iufuiI70wP/WdI5tSUqCPtJoclQ UFnTyxAecT7RTxEMxgivCrxgr/maFVP7+g2Qp+HYS5EQtNJ27+1WGRe6FOurGnKKww5K o+9IKyzGdaUy5mB213FgDZwAck5p/qtyw7RQGN1GjaP1KbnnHyrJ7lUtqjKpGDwc+zgb Jcfoch0MW7md6wOBYdu8Q/Se9NiRHTf95g3rAfR46wIhlfHmvadTdSbHr3H1RousssM5 /7EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fi5BZCbD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t31-v6si9554938pga.167.2018.09.07.13.25.45; Fri, 07 Sep 2018 13:26:01 -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=pass header.i=@gmail.com header.s=20161025 header.b=Fi5BZCbD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726599AbeIHBHI (ORCPT + 99 others); Fri, 7 Sep 2018 21:07:08 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:42143 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbeIHBHI (ORCPT ); Fri, 7 Sep 2018 21:07:08 -0400 Received: by mail-yw1-f66.google.com with SMTP id n207-v6so5831339ywn.9; Fri, 07 Sep 2018 13:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9Be7dN/R3NmgXTLGeqjDknniy0VbvWrwupfeyuN8MtY=; b=Fi5BZCbD/RuA31kGNB5SuFrZOqg1t4x5mPxOMSGiCliq2q5gQSK71QKHHPCtSTuYGO VfNXsPt6cK2rZr4yx5miWrREB+I8ddjTCOYKoZoWHLMr5KxocUsQUSELbUP30mciOKJC t4W1ASAmwKr5+J+5kH/IqfWjyzXjA3dcG4YF5tx716jnhcrm2xDonaSiiT2ZKERX9wo0 DXAqmGui/VuKX6AO9Wei4913hBQtD2Vgy2KKzVEN1YYxVlOVKyDLxjY1dpiasgzqBP2H gA84orufmobC7NqJd/Qxs4EE+WO6bBVpGErstfR3aTb8642HVDTUrpHCiWdMubiRbbNO 4rdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9Be7dN/R3NmgXTLGeqjDknniy0VbvWrwupfeyuN8MtY=; b=B601uy5l5j/7M2oZQ8D4QmqUdfzCoJNtNvjfo4B5v1ps5YpZKE033wGjpKM1vSGWwQ NoHmXMzdkTyC25zD1G+sddc0P9/kk12z9XBSB4iI5PhFpf8fl8H1CE2Yvelz8D9Q32j2 oJaq0UwI9nJvnhzkVTWADeR550zqKAdMIR3eYl1nR3AkLcKkzK1yyZBvua1TuKEv5g1R 8NYWDSs7gCkybj+ekwyC0GSYoAWX1THOIRtyHqnPUn+4ajKytadG01gNk3Vk+27MC/Lm UnQB99tdKXOFZS97a/JHnJDejwvH4GmR57TVAePM59PjWuLDEPiRJi0cmo7/zSUzOJnO QZsg== X-Gm-Message-State: APzg51DFlCFQzyo1VjsHAoA/PgK0CbBkINFHvn71yHXBfaua5i56pTM8 Yu2F0XiBVSdJaIhzJFEZB2s= X-Received: by 2002:a0d:d40d:: with SMTP id w13-v6mr5269212ywd.352.1536351873107; Fri, 07 Sep 2018 13:24:33 -0700 (PDT) Received: from dennisz-mbp.dhcp.thefacebook.com ([2620:10d:c091:200::9697]) by smtp.gmail.com with ESMTPSA id r69-v6sm3131114ywh.44.2018.09.07.13.24.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 13:24:32 -0700 (PDT) Date: Fri, 7 Sep 2018 16:24:30 -0400 From: Dennis Zhou To: Tejun Heo 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: <20180907202429.GA97913@dennisz-mbp.dhcp.thefacebook.com> References: <20180906211045.29055-1-dennisszhou@gmail.com> <20180906211045.29055-10-dennisszhou@gmail.com> <20180907175446.GC1100574@devbig004.ftw2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180907175446.GC1100574@devbig004.ftw2.facebook.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 07, 2018 at 10:54:46AM -0700, Tejun Heo wrote: > 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. > Ah yes, that's my bad. I've removed it and the unnecessary goto now. Thanks, Dennis