[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181217161104.bc4jkklw35svcaqy@treble>
Date: Mon, 17 Dec 2018 10:11:04 -0600
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Petr Mladek <pmladek@...e.com>
Cc: Jiri Kosina <jikos@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
Jason Baron <jbaron@...mai.com>,
Joe Lawrence <joe.lawrence@...hat.com>,
Evgenii Shatokhin <eshatokhin@...tuozzo.com>,
live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v14 08/11] livepatch: Remove Nop structures when unused
On Mon, Dec 17, 2018 at 04:54:53PM +0100, Petr Mladek wrote:
> On Thu 2018-12-13 17:00:45, Josh Poimboeuf wrote:
> > On Thu, Nov 29, 2018 at 10:44:28AM +0100, Petr Mladek wrote:
> > > +static void __klp_free_funcs(struct klp_object *obj, bool free_all)
> > > {
> > > - struct klp_func *func;
> > > + struct klp_func *func, *tmp_func;
> > > +
> > > + klp_for_each_func_safe(obj, func, tmp_func) {
> > > + if (!free_all && !func->nop)
> > > + continue;
> >
> > I suspect that changing 'free_all" to 'nops_only' (and inverting the
> > condition) would make the code more readable.
> >
> > And a similar suggestion for __klp_free_objects().
>
> I am not super happy with the negative check as well. The problem is
> that in __klp_free_objects() it would look like:
>
> if (nops_only && !obj->dynamic)
> continue;
>
> By other words, "free_all" works better with both "nops" and "dynamic".
>
> That said, I do not mind about it. Tell me what you prefer and I'll
> change it.
The problem I had with 'free_all' was that it's vague: For a reader of
the code, freeing all would be the expected case, so it's not
necessarily clear what *not* freeing all would mean.
Using 'nops_only' makes the meaning of !all explicit. Even for the
__klp_free_objects() case, I think it's an improvement, though you could
maybe call it 'dynamic_only' or 'dyn_only' instead (any of those options
would be fine with me).
--
Josh
Powered by blists - more mailing lists