Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp788958imm; Fri, 31 Aug 2018 13:20:35 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYSv4fdNde6ODywoqhK34EoJxZ8e8qaxRSJdYo9snO6zwhzql043cHiBQ3nsupOfKmYWjGW X-Received: by 2002:a62:f208:: with SMTP id m8-v6mr17540742pfh.222.1535746835652; Fri, 31 Aug 2018 13:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535746835; cv=none; d=google.com; s=arc-20160816; b=FJXO+GcrdGO+rE2T32LHQDiIa5VXiTiinlMFgkJvAX1ETouR8qltYFFIw4tYu4h/Bk EJJdVDFmYLPl2XXDGORj1Ip9Y61IErbt8inYhKGg0l9NHFQ7siIP5TQoXg8kJwi3DHj+ O1wahFHpdDuk3hpOQSvgRPpn9HB/m0tn35nuHyIvQp9BsrcyUhRHrt54tdUzsOj+5F52 ezSrFp8f91bdJbPqdn6Rzzjm74spGt2mypWWwXtY7ToVuXdb26sCL1/yd0Cvz7qIybv/ PTPloqcv5dMS8T7mgX+3CIxBvBoj7Sia8lb8y5GudHeftaouYsPxCKh+HLuqlRaHSLbQ P6kw== 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:arc-authentication-results; bh=Vk6eJaICnaGPvd/ak8gSgiTZzuoqUM/6teuv/tKzh+w=; b=N7RE1osyPFCXSEjedg6IP07Ldz4Ta1K0DB7vYGAXWomuvjpTGuqVsjkS086UhtAUMA rfvfyjtzGk7G36/vvvPM0/ajpdmsHROM8z1TXJm+wIe/oMQyZqDoQxmz4eD6aMz41Rf/ gFHIiNo6BNzuOTzIVKHDgIsqS1O602fQd9003K8IKEs/+YzjmaOVUdgyNX2SfKww6Clf kGeeEe9vtVVWyzJJ4xntG9W2a7AIMh8ssZy9FZ3ph3Eww56Zy7grRFa4GUJhZ78/f+7t T49+GU41/kaerUrc5VoOQ3f2wte4s/mtJXbWbckumErgNN3EIAEjY1nMRZpLivxqyZYo 1oMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TopJtve0; 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 y1-v6si10334861pgo.644.2018.08.31.13.20.21; Fri, 31 Aug 2018 13:20:35 -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=TopJtve0; 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 S1727457AbeIAA2W (ORCPT + 99 others); Fri, 31 Aug 2018 20:28:22 -0400 Received: from mail-yw1-f41.google.com ([209.85.161.41]:38002 "EHLO mail-yw1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726869AbeIAA2W (ORCPT ); Fri, 31 Aug 2018 20:28:22 -0400 Received: by mail-yw1-f41.google.com with SMTP id n21-v6so5489035ywh.5; Fri, 31 Aug 2018 13:19:17 -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=Vk6eJaICnaGPvd/ak8gSgiTZzuoqUM/6teuv/tKzh+w=; b=TopJtve0M1jk2OYvgWWQBfCKtk+Fv0HLw7ge+DUSAoydFXq3v2J0ZbIEdj14OOcy8W /0fH5/sNsnEQlGv9d8+kgosmxRSNMJzyfaJpOHI5yf35vx4blaxsaFV6E9x8xGCjN8qO HXj1OG0Ox5r/j3O0djnSnz1x98dA6+EkuyVg//C1wPReRDp9YPE9vn5dNcmE17eR5fzG /d7ri0mHHyRPOZCzYMnmNvGmyC46HT+FZVZmOsVYzIB0h/TS05yy8m9R70FuVGVDyBUU +uzN4iiPIFES0Bo7AXF+/F6uT8VXgQH6uLuHq7lxeZtySmEXFeRFIHpynmlhFalhx/1N 6WMQ== 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=Vk6eJaICnaGPvd/ak8gSgiTZzuoqUM/6teuv/tKzh+w=; b=GEDfI/orCzqNezJ0cYFMPAPpWdagSrEOjss+3qvrcRQQ/tY+QnThe9Da8yU4Wp6sfN Um9sDthtAX21b5QQ11ifciDSIlIYbyQ7FklwaLroKfl+REeZF3E+qxtzaPOoSuJGKwVb TKy/WpkSjreeuNgiCCIAwTTlLxyP9WD/a8ps5hoxc68tcqFibRlvT+Ak0l5SqXZjlhRh HO2tFb4A+eFOZE25yZpWouLQg1g33DOws7sHSrZXPHjN/CrqpwYq0DOqqm4v2hpisNlV bbblVcV+sSZHQ1xMZy1k9umu0RIufEABu30tetm1KUpWwYEkzsbTS0utGHfnfCeKrGIH eOZA== X-Gm-Message-State: APzg51CoX/iZ5nBhxg+03KcdxTPVweM6qNBFmWky4BrBC+t5/4GNzxFY 2UleT0g3/3cgLVZJizDrzGw= X-Received: by 2002:a81:83c5:: with SMTP id t188-v6mr10015697ywf.224.1535746756557; Fri, 31 Aug 2018 13:19:16 -0700 (PDT) Received: from dennisz-mbp.dhcp.thefacebook.com ([2620:10d:c091:200::3:ae4b]) by smtp.gmail.com with ESMTPSA id o193-v6sm5153332ywd.84.2018.08.31.13.19.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Aug 2018 13:19:15 -0700 (PDT) Date: Fri, 31 Aug 2018 16:19:10 -0400 From: Dennis Zhou To: Josef Bacik Cc: Jens Axboe , Tejun Heo , Johannes Weiner , kernel-team@fb.com, linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Jiufei Xue , Joseph Qi Subject: Re: [PATCH 02/15] blkcg: delay blkg destruction until after writeback has finished Message-ID: <20180831201909.GA20194@dennisz-mbp.dhcp.thefacebook.com> References: <20180831015356.69796-1-dennisszhou@gmail.com> <20180831015356.69796-3-dennisszhou@gmail.com> <20180831152705.4mjm7xo6jq7ptdqn@destiny> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180831152705.4mjm7xo6jq7ptdqn@destiny> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Josef, On Fri, Aug 31, 2018 at 11:27:07AM -0400, Josef Bacik wrote: > So the general approach is correct, but it's sort of confusing because you are > using nr_cgwbs as a reference counter, because it's set at 1 at blkg creation > time regardless of wether or not there's an assocated wb cg. So instead why not > just have a refcount_t ref, set it to 1 on creation and make the wb cg take a > ref when it's attached, and then just do the get/put like normal and cleanup as > you have below? What you are doing is a reference counter masquerading as a > count of the wb cg's, just add full ref counting to the blkcg and call it a day, > it'll be much less confusing. Thanks, Yeah, that makes more sense. I've switched to using refcount_t and renamed it to wbcg_refcnt. The corresponding actions have been renamed. I've also fixed the kbuild error in v2. Thanks, Dennis