From patchwork Thu Aug 9 14:53:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10561511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6642C1057 for ; Thu, 9 Aug 2018 14:53:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55B592B17F for ; Thu, 9 Aug 2018 14:53:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53E592B5BB; Thu, 9 Aug 2018 14:53:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2333E2B568 for ; Thu, 9 Aug 2018 14:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732427AbeHIRTK (ORCPT ); Thu, 9 Aug 2018 13:19:10 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:55108 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732370AbeHIRTK (ORCPT ); Thu, 9 Aug 2018 13:19:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1533826437; x=1565362437; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=hvS2H+y1QEVr7mVM9CmsYUDykvc0anjwXO8wsfTCrcM=; b=Ox5a+ThROle4GLTKvoWIAORGetBZEmFTHJ3jG4rVTfiUemrtixcATBY3 0azTC3N1aVSg9dQJ5NLlUPZZZL3nWOipgFYYrIoLiTggLUGEKywSNnR1N dOjAJ7GYX9KRn8wtpk93qcGo636hQICYNjcuvNUc96L9WJbXYt0w2K6Wc LB06AFcwASDWiOGLYd/3kr5gsryL+w2asJ8HpxRpSAfNgT3pjyPH+E3Q7 Yn5wMufUHng7WtskmeLYu72IiUbtIkD1ew4sJ1snsQ51160JDE6xF1DwU 1CNqpVV8HyqqsGoCvEqgXB8IcsRXqckx1DImqeAUNfkDLG54Azf4lKPPs g==; X-IronPort-AV: E=Sophos;i="5.53,215,1531756800"; d="scan'208";a="184535005" Received: from mail-sn1nam04lp0080.outbound.protection.outlook.com (HELO NAM04-SN1-obe.outbound.protection.outlook.com) ([216.32.180.80]) by ob1.hgst.iphmx.com with ESMTP; 09 Aug 2018 22:53:56 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WHdKxmiCYVHSOO103q4k4BGFNgJSA6bJTX/cUZ8oWxI=; b=O0k3KD4iGfc+WmilxT2KJ4/MJIgHd+ppGjmmRgiqKDiH/NHXlaNwBGlDo00wEmqZExbwR42jouEVvbYetnRvXeTiV9xePxHG+r9rBXgL2kD1U1dkc3lwqJUjcX61Lj5XFL44aKT4Q3iXSnnyv7HChPG+s5t6EVvTYVcnVNmZZ88= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; Received: from asus.hsd1.ca.comcast.net (174.62.111.89) by DM5PR04MB1196.namprd04.prod.outlook.com (2603:10b6:3:a3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.17; Thu, 9 Aug 2018 14:53:51 +0000 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Tejun Heo , Ming Lei , Omar Sandoval , Johannes Thumshirn , Alexandru Moise <00moses.alexander00@gmail.com>, Joseph Qi , stable@vger.kernel.org Subject: [PATCH v5 1/3] blkcg: Introduce blkg_root_lookup() Date: Thu, 9 Aug 2018 07:53:36 -0700 Message-Id: <20180809145338.6160-2-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180809145338.6160-1-bart.vanassche@wdc.com> References: <20180809145338.6160-1-bart.vanassche@wdc.com> MIME-Version: 1.0 X-Originating-IP: [174.62.111.89] X-ClientProxiedBy: MWHPR15CA0072.namprd15.prod.outlook.com (2603:10b6:301:4c::34) To DM5PR04MB1196.namprd04.prod.outlook.com (2603:10b6:3:a3::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc9a1ca8-7be4-41cc-37e2-08d5fe07ebfa X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:DM5PR04MB1196; X-Microsoft-Exchange-Diagnostics: 1;DM5PR04MB1196;3:I72Sft/fzvorHhj51Sy8J60gTA0L/7NuivoI3qhQtm90ggrDkA82R/Fqj6LS3LFDVgK2af24U+sDWtn9TFiPNVWNsecQ+r2UI/2dYKlZcsR60JZOzmfSl2xTjwhrkbptG19ed0HU+94p+5FaEBQojvOZSKf1lw5RImKF5e2Kn6JD+t/MdWsC4Rh2jnilQma9bWIX7mmAjgbph1noxTkWUUUgmlFFd0usnf2jDujPZlnmX2ix8KyCGNcl5pMh635G;25:H9SDgV+M+r+4+KNKkqL+8K0FrWzNw06BMndrtPOHiSLB/W75vofJJb6j6cw5nNpuxGTxC7tHvQTABtnrEsB5uKipoUPXtUb4xUT4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eHDCASPaFNLPnnNqePE;4:yTo5FK24erOtzdQxfhFCMB4GW/VUxhc+AORFa1ZTlqvp0qm+nja4QekFqE6gV820SvQmj5Jy3+2F35Wvx1QpqtefqBRUcT2bnt6WvOnxlX8MWa/wbD5ZmKww/4h6gaQtrTxHn76qv89Z1l8PnTuXji6jA8XNqAah62rgpqT3w+ABabPnkL2KdaZHG8+/BqdIkEFISNK3PDb+L1PSU1nR0ZrKGLF/8xwUyjYANWWElvI3c8j4x7NuTKH46FYG1k2LoY1ANSJQrNvShhLFzhB6qUVV38fKAaXWf+MSr+fDHDsPqk3p/EqEnn+ujgXCy0yP8Po1m6azPZ/1wl7JBYn/kaSVGIo+f5dRCpHPdTOHPbyF6ChYhZP4YP9X46IfHjY7yV+VX0/19x33lcOIZ59nJ9nEFtS3mepGJV8aXG qCTmw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(85827821059158)(67672495146484)(168385556255192); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:DM5PR04MB1196;BCL:0;PCL:0;RULEID:;SRVR:DM5PR04MB1196; X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(136003)(346002)(39860400002)(199004)(189003)(54906003)(11346002)(486006)(956004)(16526019)(316002)(2906002)(86362001)(446003)(48376002)(52116002)(81156014)(66066001)(476003)(2616005)(81166006)(16586007)(386003)(6506007)(51416003)(6512007)(36756003)(26005)(305945005)(7736002)(8676002)(105586002)(186003)(53936002)(6486002)(50226002)(3846002)(6116002)(5660300001)(8936002)(7416002)(14444005)(47776003)(68736007)(1076002)(4326008)(39060400002)(25786009)(6666003)(6916009)(76176011)(478600001)(97736004)(50466002)(72206003)(106356001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR04MB1196;H:asus.hsd1.ca.comcast.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;DM5PR04MB1196;23:q21svK4EyUaoneOc/UQ0pCSCnGgmmtD5F245VHWiTrOMlRnrcHHLCYR0jKi3JoQAJXVgFidUtxlMgm+3V3gGqXC7h3+eX80XLM1FiOvjRwvpQZKW8ZFYTpmxZoZr2UUdHqLwHz1svSt7nQgnJpHuDhRfGxjsWEmQdE0JdI+PQJRUiHy+jOlSn3r/9LuEIIn+34TNDPEFSBGBmP6ACeDui3qCivSh/pFxq4wHDYlTbvcbwbjCbn2kZshZBD6rv2bq/xmz1JWR3kfDGpI+6KT9abDZwk42m8LT76V0nu2GDJDKRc75JnSAppLQdp9vwza0noYX7145zZ8hZsBMVwjOOstBfraCjFp/37HgzyC+bQmEIYv7M2fZ7oHDpVSqHDHHS1kN5IsGTDyh99ZM1yVlxS3nHJwOMLlECPQYJsdFwBN45KTcAbZCBW3xwiTgAKc9d4gop4c3JbjvxHYLe45vKoTZdw/qglIcYVAy5pZuUcOk+TxAeHwP/Y1GnNgKoA30EnsstenXoY2Ak5rA7efXZw+jBnxZmT3FQoZG/UQIj6fiyniZH/ez2oaDIJ773lVEFeH81zOyqeDx5MeMFvRAlsktjjNLdjIuHgRAY9z/VqYPvxMqfaaC+5GVEgAOTHK+DJhs3BnbesAbwjXksFNlOUeSBiVniaUZr94WP1FGUa+CBaLYTE5rpHkwXsdujnY0Tv5btiNIdSG7bXcOCKjdMn4QtpOkWyYyEkcopuiYfp/ZOyylXc44k8JOxlhofZEqwwrAT1zO/gUM98EG6J81JLvsMzzqbtxUDTcz8uk3I4MsmwHH7HgMmXjUx8HX8vD09cJBefMQZskMqv6LOJfxSYJVFXhSehDhDLvzLh3S0EiUhO2oL7ZiDjISkvbFh0xrxuc1vwWcxMTQejRroR2VYVI7lSdOxg1ssg3QZalpWCT3YuPciAdm4vjTJF0rNcaM0PyrPaDVsQ/oHTAKJ2XOtadruuV3Tbw+F90HgaGTMr93mc4R/9Uq4dtxHfUMf9Wvyx5FAZgVmrLJy3BIsBu/AoOf+VjDfw9mIWLkNAzTtB3q9iOi5pPluid89anUJO4+Dy4NFsqW+SPdfUHXWj6jlzH2TTtN9GzC687uVs8zxi1z9GKtkkcPYXVjTFgoK5pxGD93Bg0naBZhd0hKBgJUx3LHaaKv5YjrxKgiNfcZR2ukThVacAfFG+0H69BknDM4CS+xeYlwqmG9R/mHHFjyceDiPpSI0AVNpc73q/nA0qfj8BnENhxIp5/EkyafnELnqbu7fJTFfwTaU5f8AwryKA== X-Microsoft-Antispam-Message-Info: JTjMggtpocLV9mk7/dINo5gcUaE07yu6ddHR21hr+7QAuDzIPQ0dRdwd5yyCOMx8R58gVUtEJozrtgxS09vjIR4/C7IySxGN0GC1wMK4wfHqY0gTercw30LN7AiRplld9opmTHbda8BCww/NIJue1Tnt6n+qgPJawlt3SXdQAFcZPTiDi7huPyKasCDEAzkE8cXd5qM1h6PW1+2OZxbI0qi1i+88v8e9Oh18WZn/g2idngEM6e80eJ34NJT97iqx9MklaTqo9TXbEt5vpU7WO5WsiTIvK5UME9UlQIipZJij1vRcWwDYmRsp3p/QS6sg2yBL5FY2X9BbEW5IOO5CIqCe9Hut5m/7gV71bJcFuNc= X-Microsoft-Exchange-Diagnostics: 1;DM5PR04MB1196;6:/5D2OwL166tOB8UhcOPMIRW8ncwiYlwGJip9TWIe+MgFGa95VS8WnSXZJXn8wCHgKL36txA8jkgagAOaruMT6qVatEp1E5nQHxYSM9dQ/463lafLeiZ4kxApRmi92Kywfx3ufx9GLiahIvHDTwomsV3Swoko/GU4WHwg+WvrfhygiVRECpYrtKVXQ4vPBVHww5e+05/CU+zSANS+h/qlA3ULnAf6VN1hxXvokKZqDZG9Q2ikzbaRiJZh4y1zVR86M8n3VijvEEVSQCFkLp/qWCbXnRO+y689b60b1ZxbzZkuMfQZygyv2t+oYkDq6K00knbzqccZD2eG2Ao5y9VcgkVAE2NsFrpXXzMFa1WA5UQlDRMzBQslh2FP8PRjTIiGYac5rMGB/ki+4lwPqdzH9sSqGgMWr283YgRy5ZSdLNp364eplT7auEDVZ+iHcM5ssY7yErmlEylYi9nCrY8YoQ==;5:UxvoZbuJXMNxncqB2ofy6bMxjT2ja8LhTwRKr7+5+jl10H1nXtaZK20eTQluDFT8aTUhoyMou6ydJb0Ql0w04MzpxFAzjWlZhgHnBStHFWI+BaXV00mYoV4ZsNf2YsiJeKbK596Ei10l3QX89gOK+FDDWyJlPNRRPfGtFzaD9X8=;7:4Rw5+KEMlVPJj9x2gbPYYkTcqL81XLuFhjpe1PneB1DaSAJx1TA3ToQCp0woWd+FOdl41yvFiMytX6AE9AJp6vYhlkd+lZk7BQMY9Iil8IPNyGsAMj6+jXt/kijCwbPVYPEaPwLphZyJ44iFUO1JaK0XGzrEJmG6QFEJAl+vgQx+zU6arkNx8FeAVurHZ1SmF3uvv7ApUEfnCm0tYZZNi+f5/HuOPPbbTfFO5qGMPcSRmP2z9f8slcLXIZncR4DL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM5PR04MB1196;20:SSAWhm9UbA3HDxhFmj/hS6oIZZBg3H/x7jczEnWWz+HmqNvLkEV9oTXrhwnJYCmjWY/RWWCtABlieoqpVFfvqcyHflcD9F2EWwcRSzGrKBlxZs/Rz6VVdk+bn+orNC4khSO9tO9VH+IHcPJMErHy+YMpb8S+4HKEb2EhYbcHESc= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 14:53:51.1156 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc9a1ca8-7be4-41cc-37e2-08d5fe07ebfa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR04MB1196 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This new function will be used in a later patch to verify whether a queue has been dissociated from the cgroup controller before being released. Signed-off-by: Bart Van Assche Cc: Tejun Heo Cc: Christoph Hellwig Cc: Ming Lei Cc: Omar Sandoval Cc: Johannes Thumshirn Cc: Alexandru Moise <00moses.alexander00@gmail.com> Cc: Joseph Qi Cc: --- include/linux/blk-cgroup.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index f7b910768306..1361cfc9b878 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -341,6 +341,23 @@ static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, return __blkg_lookup(blkcg, q, false); } +/** + * blkg_lookup - look up blkg for the specified request queue + * @q: request_queue of interest + * + * Lookup blkg for @q at the root level. See also blkg_lookup(). + */ +static inline struct blkcg_gq *blkg_root_lookup(struct request_queue *q) +{ + struct blkcg_gq *blkg; + + rcu_read_lock(); + blkg = blkg_lookup(&blkcg_root, q); + rcu_read_unlock(); + + return blkg; +} + /** * blkg_to_pdata - get policy private data * @blkg: blkg of interest @@ -864,6 +881,7 @@ static inline bool blk_cgroup_congested(void) { return false; } static inline void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay) { } static inline struct blkcg_gq *blkg_lookup(struct blkcg *blkcg, void *key) { return NULL; } +static inline struct blkcg_gq *blkg_root_lookup(struct request_queue *q) { return NULL; } static inline int blkcg_init_queue(struct request_queue *q) { return 0; } static inline void blkcg_drain_queue(struct request_queue *q) { } static inline void blkcg_exit_queue(struct request_queue *q) { }