From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932459AbbCXPz0 (ORCPT ); Tue, 24 Mar 2015 11:55:26 -0400 Received: from mail-qg0-f44.google.com ([209.85.192.44]:34843 "EHLO mail-qg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932433AbbCXPzU (ORCPT ); Tue, 24 Mar 2015 11:55:20 -0400 Date: Tue, 24 Mar 2015 11:55:09 -0400 From: Tejun Heo To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Christoph Lameter , Kevin Hilman , Mike Galbraith , "Paul E. McKenney" , Viresh Kumar , Frederic Weisbecker Subject: Re: [PATCH 2/4 V5] workqueue: split apply_workqueue_attrs() into 3 stages Message-ID: <20150324155509.GH3880@htj.duckdns.org> References: <1426136412-7594-1-git-send-email-laijs@cn.fujitsu.com> <1426653617-3240-1-git-send-email-laijs@cn.fujitsu.com> <1426653617-3240-3-git-send-email-laijs@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426653617-3240-3-git-send-email-laijs@cn.fujitsu.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 18, 2015 at 12:40:15PM +0800, Lai Jiangshan wrote: > +static void wq_unbound_install_ctx_free(struct wq_unbound_install_ctx *ctx) Maybe naminig it more consistently with apply_workqueue_attrs() is better? apply_wqattrs_cleanup()? > { > + int node; > + > + if (ctx) { > + /* put the pwqs */ > + for_each_node(node) > + put_pwq_unlocked(ctx->pwq_tbl[node]); > + put_pwq_unlocked(ctx->dfl_pwq); > + > + free_workqueue_attrs(ctx->attrs); > + } > + > + kfree(ctx); > +} Wouldn't the following be better? Or at least put kfree(ctx) together with the rest? if (!ctx) return; the rest; > + > +/* Allocates the attrs and pwqs for later installment */ > +static struct wq_unbound_install_ctx * > +wq_unbound_install_ctx_prepare(struct workqueue_struct *wq, > + const struct workqueue_attrs *attrs) > +{ apply_wqattrs_prepare()? ... > +out_free: > + free_workqueue_attrs(tmp_attrs); > + > + if (!ctx || !ctx->wq) { > + kfree(new_attrs); > + wq_unbound_install_ctx_free(ctx); > + return NULL; > + } else { > + return ctx; > + } > +} Let's separate out error return path even if that takes another goto or a duplicate free_workqueue_attrs() call. > +/* Set the unbound_attr and install the prepared pwqs. Should not fail */ > +static void wq_unbound_install_ctx_commit(struct wq_unbound_install_ctx *ctx) apply_wqattrs_commit()? Thanks. -- tejun