Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751946AbdIMVnj (ORCPT ); Wed, 13 Sep 2017 17:43:39 -0400 Received: from mail-qt0-f169.google.com ([209.85.216.169]:44916 "EHLO mail-qt0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbdIMVnM (ORCPT ); Wed, 13 Sep 2017 17:43:12 -0400 X-Google-Smtp-Source: AOwi7QB4m8rc7kIJYP8V1329zFaiBUH3LC72crJfanmUx9B1zudO8OV48N1G2FqymR89feDNXvnLMw== Date: Wed, 13 Sep 2017 14:43:08 -0700 From: Tejun Heo To: Shaohua Li Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, lizefan@huawei.com, tglx@linutronix.de, kernel-team@fb.com, axboe@kernel.dk, Shaohua Li Subject: Re: [PATCH V2 1/4] kthread: add a mechanism to store cgroup info Message-ID: <20170913214308.GE378890@devbig577.frc2.facebook.com> References: <802ba16bd896e56bc974780e97157760fde7c273.1505335620.git.shli@fb.com> <20170913213820.GA378890@devbig577.frc2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170913213820.GA378890@devbig577.frc2.facebook.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 390 Lines: 18 On Wed, Sep 13, 2017 at 02:38:20PM -0700, Tejun Heo wrote: > Maybe doing sth like the following is less error-prone? > > kthread_associate_blkcg(@css) > { > if (current's kthread->blkcg_css) > put kthread->blkcg_css and set it to NULL; > if (@css) > get @css and set kthread->blkcg; > } Ooh, also, maybe add a WARN_ON_ONCE on non-NULL blkcg_css on kthread exit? Thanks. -- tejun