Received: by 10.192.165.156 with SMTP id m28csp1190650imm; Wed, 18 Apr 2018 05:49:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx49/xBsTsoeFXLXPeNOzbkAnlwljmank90DpBLBegE/ViTAibcl0Tbf1joEGqs9ZX6RjXz3z X-Received: by 10.98.33.28 with SMTP id h28mr1834871pfh.249.1524055754718; Wed, 18 Apr 2018 05:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524055754; cv=none; d=google.com; s=arc-20160816; b=BLFu05hT43FWQbqJQjEMP90HxW4EfPV10MmxWeOgCYtlfiZD6GT2GRQYdg/eFozPt7 +hkINYsnfLlVWdL4v5O1K3L4DMj3lPeHXHgV5774wxyqagaLCBMzlBJD/GYZOwrtsU6a qHYInCTsMt4tK4jbOiOAjgz0lJh0r5iW4tuMvvdqRocox4av2YIY18R/ycbE4l8U7qLC WcFuJ7zMlJrfQtnldS6iKWZ2glJB2y3E0byFQ5XvWEJDbcazu1LDfGkz+Y2/9Xqszkkg PRSwg0aQr6GJpxtA+uXQvF5qxPTqSHnMT2sT2iUd75pdc9uZdgDgrMPe+wcaH/ODL1EH kYlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=84NpOSRo5q/fGn3ns43x2Qe9SgmrJKBu9mPznBRB0ss=; b=xwNTNfa0u72RepAHEtWTm1wBrrYpwcsMChG0fTE/ZlgZz1Va3+EVRIFjZ9aYABymH4 yAVA1YnuusI8oXASTEsF95iYrbiLdtsriMGMAhRHiIYICnfb6ZVYtlaM5kEPGW7BRr77 3iqQ8wnJR9BC8iVD0oNjJaUni3kUmILweGbUImbeo0te4QQ+QO/0GGiTv9mBr74TLE5W NBCP/dZL5WND6ikMWnt9ecPwGHOh376NOE+5UTC9bipkWge+Pj4SW7nRy4yOv15PjbPc 5/O1iLZelesGeaYGVY73RRpnwiLbdJRpjRGeYY/BzHAF6SSDZhHE90RsjnL5KiFbv7wJ NNJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d/mhCneS; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12-v6si1185449pll.467.2018.04.18.05.48.40; Wed, 18 Apr 2018 05:49:14 -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=@linaro.org header.s=google header.b=d/mhCneS; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753845AbeDRMqP (ORCPT + 99 others); Wed, 18 Apr 2018 08:46:15 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:43954 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753210AbeDRMqC (ORCPT ); Wed, 18 Apr 2018 08:46:02 -0400 Received: by mail-wr0-f195.google.com with SMTP id u4-v6so4451342wrg.10 for ; Wed, 18 Apr 2018 05:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=84NpOSRo5q/fGn3ns43x2Qe9SgmrJKBu9mPznBRB0ss=; b=d/mhCneStX/a+pPlLZBaBz/LkzOeKOPWdqw7jEm/qJQbMhe9TeLpktOMgeVtQEN4Ff fMXUWypt1a4rmRFbLA+0a940JioHjvgmngVQL7UHTp3L9MsP/rUm8Fw/dePdAmQQAjZV RWWees5UZtfzKVVMQYs7MSOcR6hMyQxyfPT/U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=84NpOSRo5q/fGn3ns43x2Qe9SgmrJKBu9mPznBRB0ss=; b=q1GObeg5PPHh6xc6CrxdLgNaFnJ0o9/wOWDPP/n0hImN2GnA49+RMYvYU/dGIySEmx vhcucFPyi/6fTLVbIWiPLTTJWoYP0jNDMxRWYORX0OJpgsViHxsIbJukXBgl+2BzpVPx hRFP3WWsnRv14WBVEi2LgkOSfybcft7ZxU5KtDwDRQ8nK+Xtg4BQifG+nwWwaUkBmZjM 0o5NNjyluA5rZro/a7uhHWyuNtBZsal8qSzTH2FPhA4HVYyZTEpZ4ue4N2fT4DhnZF/t FUbPZn9/qRa05kEdlNaJcA2H7GwFz+6VmhDtx2NEe8BKe+Aza4+xeRvjmO/ygkS7t9oH aGog== X-Gm-Message-State: ALQs6tD542gbFGyujZc1HAM3cIEHdL4W8V/VdmdA5W6OAxMP6iUuTOoz kZoOh+LvTQtWfENAFTHBoPJrSg== X-Received: by 10.28.109.27 with SMTP id i27mr1715803wmc.109.1524055561237; Wed, 18 Apr 2018 05:46:01 -0700 (PDT) Received: from wifi-122_dhcprange-215.wifi.unimo.it ([155.185.122.215]) by smtp.gmail.com with ESMTPSA id d28-v6sm1147039wra.37.2018.04.18.05.45.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Apr 2018 05:46:00 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: [PATCH] blkcg: not hold blkcg lock when deactivating policy. From: Paolo Valente In-Reply-To: <201804181718167747438@zte.com.cn> Date: Wed, 18 Apr 2018 14:45:57 +0200 Cc: axboe@kernel.dk, 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 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1523949033-91148-1-git-send-email-jiang.biao2@zte.com.cn,661CB1A2-5BAC-439D-BCE2-64F9A0CD280E@linaro.org> <201804181718167747438@zte.com.cn> To: jiang.biao2@zte.com.cn X-Mailer: Apple Mail (2.3445.5.20) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Il giorno 18 apr 2018, alle ore 11:18, jiang.biao2@zte.com.cn ha = scritto: >=20 > Hi, >>> Il giorno 17 apr 2018, alle ore 09:10, Jiang Biao = ha scritto: >>>=20 >>> 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. >>>=20 >>=20 >> 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=20 > update of blkg in the common code is protected by both queue and=20 > blkcg locks, so IMHO this patch would not introduce any new problem > with bfq, even though bfq is not protected by queue lock. Thank you very much for checking. Then: Acked-by: Paolo Valente Thanks, Paolo > 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=20 > 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.:)=20 >=20 > Jiang, > Regards