Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1048228imm; Thu, 6 Sep 2018 14:31:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ4Ldsx65wRmNn7HTv6r7N87hv6+SEctYFsdHnBhGcm9iGP90JWBS8UM/ZvPb/c8WuQebJZ X-Received: by 2002:a65:668f:: with SMTP id b15-v6mr2305044pgw.426.1536269494297; Thu, 06 Sep 2018 14:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536269494; cv=none; d=google.com; s=arc-20160816; b=n/6QrK6DrzHNgPUp/O62eEdH/VxIjRofglhYf6OqPuo9uXBvnS7vmyEsqWiIGdWZ7/ ELLCDirGOy4XkPbr2QB/N2AUcVBWtzoZvtEKdcsOkn82xx3M9MDEWPQdYowq0nTp7uf3 vfKI0THZhub33L3ka7VV0iACoTmp0rD5cCAKDB5PKgJdfRKUmZZIkEiWPuBWLZ8o1CNX DGZOnGHV3s5OZiX+nv6d8T9YyxIwVw4y+NJhn0qbH1pYz6UoBmcry5CmFbRWpFk2i2C9 60P3KWfUCXPPGjBGkTEJqtik0Icp3LlZl6nWhc0XHFvNDM/H4CaP1vmvowECohQ5Qecu glTw== 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=Z8m+mEIJj3McDnXqQOUT9a15bnp+tQ5IwmM7Yv0JRl4=; b=GAinCTrpTQwsXqRIPlB19VMvfRuxhfZ2mQT1dNMJWYxCG4YOsVszv8IeYu9aCcMo2P nN60h/v+goRaxGeMXuLY43RmUsUOjGaDHA74rnUEtCWKva4Z52TCQ/FlnbB0CIZr+MRB ga76lGDOTzu9AeOJw1Ninz9V6Ea7+2tF9bTscQ7gr5+5naQ0qpvyiiVoMpuHcDEthfe4 TvJF5E1Nx+TScLo26PXqvafpq7P4PAsp5XGKNByBIZk8YiEqZSXJFexm7aGccYyHtcSK 2REhzU1FpYioqukj1zclgIuPTwpp7sD/UfVCCfcDttmTfT8s2nMU8cyte4ackE9uydks WhhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aplzBXnw; 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 u3-v6si6084227plb.401.2018.09.06.14.31.19; Thu, 06 Sep 2018 14:31:34 -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=aplzBXnw; 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 S1730111AbeIGBWa (ORCPT + 99 others); Thu, 6 Sep 2018 21:22:30 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:43561 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727629AbeIGBWa (ORCPT ); Thu, 6 Sep 2018 21:22:30 -0400 Received: by mail-yw1-f68.google.com with SMTP id l189-v6so4600250ywb.10; Thu, 06 Sep 2018 13:45:18 -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=Z8m+mEIJj3McDnXqQOUT9a15bnp+tQ5IwmM7Yv0JRl4=; b=aplzBXnwlI76XyctZYm//zUKqdO0Bscy1fKttYicmoFaQIweIAaTwuYJ6c+e0908L9 kj3CI+eX7NImufUT2SmVS5tdfW4DBXf6ywReEV49i/D7sScDWBL5doPRZ9gb/m7VHNvE JYw80XZL8ho9/N/usYHmK/IrhQ+Zhsx+MJB8IVCndw6/hKp5DBKUk2ZuCdfg1v7u7/yw 31mtL7wGswKBa6DAyVairUnIdaCthkDGPSv59RhR2CN6SMNPtHdgBdvjWpUnKZw8GsuC Hu2lOoGuhjOooSiEVwgfCtsSCamYEOx4Ikactw0ntp9kEJDsz3d9AzvQZmycsBfgJBKH bTMg== 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=Z8m+mEIJj3McDnXqQOUT9a15bnp+tQ5IwmM7Yv0JRl4=; b=J70YjX7q18C9nX2oJRQRFOXPU03MI6tBOl8fedtRd/Y4RsfUqRCX7c701Tv1wCadQe 7ScOOl1aG3MCVEermYQ7Xb75jZYfSMGeFwgXy5M4A7dGN7rnlJQo4CirSvZYplAOqTOf pjShJvuPuILqIgVlJYpCfZ7U47O1SEGQAUftbBgaUsh6LqNerJTOSbwKm7Enw5I9tHGd 7DgCS1BA/eCu2YvMQJklPTIBtN6NOXEWCud8V3Xenuz7oKWUiSv6QTZ9Jw8f7lCK6qtM 6xf26tzlI/JTHQPinOM+SRwHmeS9b5aeaQNvzc8/r3S+OZCsz0qTbs91U6RsU9vAVlLk q1+Q== X-Gm-Message-State: APzg51Ba5BhBK1zJdnmxckQ43ReVbIJRsns6lWGCc/u9yj01w78mGrOb fZK1H/aQYGZnL9kqh5Ha8mY= X-Received: by 2002:a81:8641:: with SMTP id w62-v6mr2517215ywf.293.1536266717725; Thu, 06 Sep 2018 13:45:17 -0700 (PDT) Received: from dennisz-mbp.dhcp.thefacebook.com ([2620:10d:c091:200::3:20a]) by smtp.gmail.com with ESMTPSA id n187-v6sm4341264ywn.76.2018.09.06.13.45.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 13:45:17 -0700 (PDT) Date: Thu, 6 Sep 2018 16:45:15 -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 11/15] blkcg: remove additional reference to the css Message-ID: <20180906204514.GC26048@dennisz-mbp.dhcp.thefacebook.com> References: <20180831015356.69796-1-dennisszhou@gmail.com> <20180831015356.69796-12-dennisszhou@gmail.com> <20180901002603.GI1488037@devbig004.ftw2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180901002603.GI1488037@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, Aug 31, 2018 at 05:26:03PM -0700, Tejun Heo wrote: > Hello, > > On Thu, Aug 30, 2018 at 09:53:52PM -0400, Dennis Zhou wrote: > > - css = cgroup_get_e_css(page->mem_cgroup->css.cgroup, &io_cgrp_subsys); > > > > - return __bio_associate_blkg_from_css(bio, css); > > + rcu_read_lock(); > > + > > + while (true) { > > + css = cgroup_e_css(page->mem_cgroup->css.cgroup, > > + &io_cgrp_subsys); > > So, while they seem similar cgroup_e_css() and cgroup_get_e_css() > behave very differently in terms of locking. cgroup_e_css() can only > be used under cgroup_mutex because it is used during migration and has > to test cgroup_ss_mask(). The right thing to do here would be > renaming cgroup_e_css() to something else and add a new implementation > which operates in the same way as cgroup_get_e_css(). > > BTW, this should have triggered lockdep warning. I'd strongly > recommend testing with lockdep enabled. > > Other than that, looks good to me. > I see. I've renamed the original cgroup_e_css() to cgroup_e_css_by_mask() and then did what cgroup_get_e_css() did without the get part in the new cgroup_e_css(). Thanks, Dennis