Received: by 10.192.165.156 with SMTP id m28csp149810imm; Wed, 18 Apr 2018 19:12:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx48gAuWx2j2MrO5e3f+Qq3CyQIlv0P9zjWx3SVw3/8Bvl7SidWC8xuuQ+U790jArl1Ovkb4D X-Received: by 2002:a17:902:9a9:: with SMTP id 38-v6mr4365014pln.114.1524103926780; Wed, 18 Apr 2018 19:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524103926; cv=none; d=google.com; s=arc-20160816; b=zgCCCvTMRr2+/2LdPB/HBzGOxwgSZyHUOsMcHJtDt9+u2/ObUVzklkZq+F2Ajo7hrZ LmQ9KJ64KpMbA9WHEYptUg8u+Bs8pBh4eYYHNYVai/+Zy8ozB1e4v80BnsvzguOz3kJe T48NUhrY9zt3BDAD/tyzhw5pGVAYP4VH4mwGgYkqKbKULpdJaUAAjHeQTpz9yYukkcqZ OJ+jZ++N6BBTzv4xkbb37RAUu9s5vTWWd9hrEIoPOscU404Riq6CM4uj8Ur1MSWiQ6FN ZiBWpxIO5EWc263+EDtXo0hHfSMXKi7Njtw0AUvM8XLb926GgWW9IT561/50cVbGYFWM 4Wdw== 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=fKpT1RlmAm9aLj4EHoXIO9bkoSkr5vMl9eBRTiU6BaM=; b=FDWG6NQ3ymMt83suGngRjLkfdjFlEcUz2lC8rU8oprozQNwi+grh9CAn8QdUeqflzY bUhPaGB1MQjKLFz4UouPFf3n7JPXrhogr7OLyqJxpdo6ToXPE9Z1iyi4VaFhidok0b3p BgwWFQH4fkFr7CugRCBdbB/eU1Yw58VGYQNLYVZFntO8K/Pv8eety6eegHUSXbfZ1bm+ hRg+q8NGLnuhRCOBPUNQvt54fieBEepBrmitqdMsEnYNtE8mSdh78T5zN6Za818dTJn/ S0gFsNA8Nzq89UGLrxrt4R+uZc0VLjU5WXjrqZY8+Bs6M0IE0Y0bY1fFPMd/mq/AcM6v 4TKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=lw39cwtc; 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 d128si2088567pgc.445.2018.04.18.19.11.52; Wed, 18 Apr 2018 19:12:06 -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=lw39cwtc; 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 S1753088AbeDSCJc (ORCPT + 99 others); Wed, 18 Apr 2018 22:09:32 -0400 Received: from mail-pg0-f48.google.com ([74.125.83.48]:43533 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752786AbeDSCJa (ORCPT ); Wed, 18 Apr 2018 22:09:30 -0400 Received: by mail-pg0-f48.google.com with SMTP id f132so1740733pgc.10 for ; Wed, 18 Apr 2018 19:09:30 -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=fKpT1RlmAm9aLj4EHoXIO9bkoSkr5vMl9eBRTiU6BaM=; b=lw39cwtckKhMqgngma0L1bmUuKfycIbU8y/xU7bIK0kACBWDnPXlnMxw5JYDmoOuVL sp3Y3h1fPt/JFjN/PTLRCgx9GjtzEWjRTYyh+q26AqreYk0Obh2SwpauHWEX5YZjgEsW u5hbbCfkv+gwuTfcwg+mqnYWqvoj2gxO9EuuuMQUbmqjErS9QqkeglYxaDdgLXpDO7Ga 9OZaAB9+hBFvBI+4MjW5j6RF2nly0K6aCC/5EgGMs9qbdZJoSTTmo4fhitPB37WMcalP sZrSePE4A0w8y+/Me++c42gmf0yRVXhWVCsu41KCbGLI51vwjanWW4jU7rrTwcigVjTe uY3A== 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=fKpT1RlmAm9aLj4EHoXIO9bkoSkr5vMl9eBRTiU6BaM=; b=eVAM73X85z/2vrUZXarbJZqeKSIvDtp6XPNKPs79xZVeVHEdaBUhXt233kQ+8M3/Y9 zN5ODOU8j1TvAeOcf45At1Zuyo1xJmjd6Z9ukKUAaHTObo41AOEGoMFS2UwSDMcMVCe9 rhh76gxbIuVf46/DLCoRYqDC+6SXEfzf0Xtelu5WRym2XpqhQmBIFdtZBAg79/UbG/sH aCSSIQR4+aJBxHzG/+0HzSP+0Pg4sYUEx+d7LUcIxl4MCqkyhIZrngKdb/Q2aoBHT5+V W+umK8zIyQezKKQXtGPeQVh88RVF3J9Qfvk9cJ9rJ8LgGRTbmxl7uA1NGWo15bjc4Lr2 RQlw== X-Gm-Message-State: ALQs6tDQzxTi7Q8tUCiz4bHrBaYLlX9DYJTsn6pigmZZXNTKCW9nNLsT p7bsKhwo10ngPHmipk5pGRnwNbL/GJM= X-Received: by 10.99.126.92 with SMTP id o28mr3494372pgn.194.1524103769942; Wed, 18 Apr 2018 19:09:29 -0700 (PDT) Received: from [192.168.1.212] (107.191.0.158.static.utbb.net. [107.191.0.158]) by smtp.gmail.com with ESMTPSA id v23sm3933547pfm.59.2018.04.18.19.09.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Apr 2018 19:09:28 -0700 (PDT) Subject: Re: [PATCH] blkcg: not hold blkcg lock when deactivating policy. To: jiang.biao2@zte.com.cn Cc: paolo.valente@linaro.org, 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: <201804190854343346115@zte.com.cn> From: Jens Axboe Message-ID: Date: Wed, 18 Apr 2018 20:09:26 -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: <201804190854343346115@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 6:54 PM, jiang.biao2@zte.com.cn wrote: >>>> 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. > Actually, we've met a triggering of nmi_watchdog, blocked at the queue lock > in blkcg_print_blkgs(), caused by the slow serial console and too many printks. > Related discussion is here, > https://bugzilla.kernel.org/show_bug.cgi?id=199003 > Even though it's not caused by the queue lock directly, it would not happen > without using queue lock. The queue lock is big and used too widely, using it > would intensify the race, so we're trying to understand the locks using in blkg, > and maybe could improve the situation. The queue lock is only used widely on non blk-mq, where it is the only lock really. Doing serial IO under a spinlock is always going to suck, regardless of how contended it is. -- Jens Axboe