Received: by 10.192.165.156 with SMTP id m28csp1309244imm; Wed, 18 Apr 2018 07:42:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/O+eZjsi1Xb7iG/DlRNm6VY7a9CGiuBRCYssmbSRPG5u4O2xVE4BcE32HmbF0wPxLZ14eQ X-Received: by 10.98.91.71 with SMTP id p68mr2256741pfb.128.1524062520222; Wed, 18 Apr 2018 07:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524062520; cv=none; d=google.com; s=arc-20160816; b=Gmnz7eSsk+VQuie+n7Q5ttsN2qrtyb3d5jWKhrx89DS8+yp6jpC9w+hoMPBsLQmA/Q /QuoJXeM+0l7Ek9RBWhi0DAOHEarTe+7rU63rkj1Ddo689Itb5a6owjs7p7MM5KbPhEy MtAJQ3AyN6pn1VdKMfxVNAeUahX+Q1edWz3mjxrRhrP/X+CPzXerxuMM+z9Vt8cWb3nc ioUvmL9WadOG7OWTqrQ0bV5X0BpwpUrKq0Gfe3V3TZQ94irgf2F5tZ8oHK865oUBj3+n QlFOdcAu3Z0sN8SAegXmpH8dR1Ko0OkT3l/KTyVJcfujBnO9Ostt2peyyduFKJrTWgaw DgrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=z+WXsbsGHA++e60Kix5MtmEnb0mAntST6iCgf5kIYh8=; b=0F1d8vb1LsPt3eMh/0fNU2EL6wEqNqRyrI1VFpuao9JhR6GjfqVg3i0ArGQAArU21M yV3qPYPnKRjWhhQjvVfkJYAPX7J2ect229Jh0l4Ljj4DYcCrp927zChBbRbz2eeDc46f 6Fcd9ZPdmWqQ87e0D0g6FgLgYpG5gx0aLuHuQbxDlrFq5qBLmc5LGW4QZmqjJFPGltJq 2ycVg/M8eyQEfRwMOqOEh69pOnw2BWViX/cjVNI3BOqsjdfEq3IeDa7WHbdO+zFR8Yxw Kfx3MSQZtI2LxHFz6mP8m2xDyR7H/JqM+CCs4RccBe3gzmSv1UsroFXEKjwihWjNjomW Ct0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=az8n7g/b; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si1206244pff.125.2018.04.18.07.41.46; Wed, 18 Apr 2018 07:42:00 -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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=az8n7g/b; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753815AbeDROk3 (ORCPT + 99 others); Wed, 18 Apr 2018 10:40:29 -0400 Received: from mail-it0-f46.google.com ([209.85.214.46]:55584 "EHLO mail-it0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753658AbeDROkX (ORCPT ); Wed, 18 Apr 2018 10:40:23 -0400 Received: by mail-it0-f46.google.com with SMTP id l83-v6so1735493ita.5 for ; Wed, 18 Apr 2018 07:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=z+WXsbsGHA++e60Kix5MtmEnb0mAntST6iCgf5kIYh8=; b=az8n7g/bPMVTwnvWFhpBLnAfFG/9i+BKginWoN/pgx+gUpzM3sc59e2/LSpdsDRoAA FQUCgld8KqTXIyY7w57dyLfNN8xe8WC02DiOj53FrQ11ZD1QzC/JCYhihsFYkX46yMT2 SRb1YcNuba2xYKe4YHQTDN/yPLzjVTKKRfkUE+Y3sTT6BE/vhxpAcHQO6MAOYSE2Dc3w WaMya/upG9Kvz8JYtYTLn9vXDxqVVrh79UftsciyrRNFWYTP6aJVtmoQ6p3yWK4PFvX4 seP03DNbNG+YpC2QJ6p3lUyLsJ+0iGiyENrBq+QnQbxfuop6TWGTCN3RffpMT2W8T5uX DsJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=z+WXsbsGHA++e60Kix5MtmEnb0mAntST6iCgf5kIYh8=; b=HukZB0HHcz9AS2BYbw96RVstI0TS+H8L8SPKNhtz99PGzx3t840aXezV+wSlTDt/3l B5ZgZC3YKJ6yLgkYuUFzgnEKbP7Fd9egFFI8kerFSlAABNWWT30lHOxLNhlOQgzLsJol Vi9s2pvQuIXBhm22SPIa5SKECAC9vDRYQCztSWt7oldqqo71l/Mi6gUb/5v3NLAtxFz5 MWs+ab+j2vm71OOXRTwPhgVkxyfeG3aPYhz6iEx5P1knP0WVvpzhSX65bm5ESkayEcsK DBwL9eSE9nDDYTV+SlhEGn51VgSeJGi/BVLyxgbWyeCmC4dXGYiTjtgkyMcFB2RRPqSF rSwA== X-Gm-Message-State: ALQs6tDyXXlBN3hzhSM5r9L3Ppo5DorAg12AzyH9QPApDNJvYKbNLFKv BPz85oqo2z6alBbkfAeYs/wJag== X-Received: by 2002:a24:62c2:: with SMTP id d185-v6mr2716343itc.74.1524062423113; Wed, 18 Apr 2018 07:40:23 -0700 (PDT) Received: from [192.168.1.167] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id b66-v6sm216909itb.3.2018.04.18.07.40.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Apr 2018 07:40:21 -0700 (PDT) Subject: Re: [PATCH] blkcg: not hold blkcg lock when deactivating policy. To: jiang.biao2@zte.com.cn, paolo.valente@linaro.org Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, tj@kernel.org, zhong.weidong@zte.com.cn, wen.yang99@zte.com.cn, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org References: <201804181718167747438@zte.com.cn> From: Jens Axboe Message-ID: <3a699198-edf4-7337-f5e7-faaa6b058713@kernel.dk> Date: Wed, 18 Apr 2018 08:40:20 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <201804181718167747438@zte.com.cn> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/18/18 3:18 AM, jiang.biao2@zte.com.cn wrote: > Hi, >>> Il giorno 17 apr 2018, alle ore 09:10, Jiang Biao ha scritto: >>> >>> As described in the comment of blkcg_activate_policy(), >>> *Update of each blkg is protected by both queue and blkcg locks so >>> that holding either lock and testing blkcg_policy_enabled() is >>> always enough for dereferencing policy data.* >>> with queue lock held, there is no need to hold blkcg lock in >>> blkcg_deactivate_policy(). Similar case is in >>> blkcg_activate_policy(), which has removed holding of blkcg lock in >>> commit 4c55f4f9ad3001ac1fefdd8d8ca7641d18558e23. >>> >> >> Hi, >> by chance, did you check whether this may cause problems with bfq, >> being the latter not protected by the queue lock as cfq? > Checked the bfq code, bfq seems never used blkcg lock derectly, and > update of blkg in the common code is protected by both queue and > blkcg locks, so IMHO this patch would not introduce any new problem > with bfq, even though bfq is not protected by queue lock. > On the other hand, the locks (queue lock/blkcg lock) used to protected > the update of blkg seems a bit too heavyweight, especially the queue lock > which is used too widely may cause races with other contexts. I wonder > if there is any way to ease the case? e.g. add a new lock for blkg's own.:) It might make sense to lock it separately, but I would not worry about it unless it shows up as hot in your testing. I've applied your patch, thanks. -- Jens Axboe