Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1418822imu; Thu, 13 Dec 2018 15:01:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/UyuL6Xb+w4isVpShbuBmvwdO/9AswCWFy0PuAFNXfWys78H6E2uAfhAsT7jd9lU+bn1rjg X-Received: by 2002:a17:902:108a:: with SMTP id c10mr635322pla.131.1544742119355; Thu, 13 Dec 2018 15:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544742119; cv=none; d=google.com; s=arc-20160816; b=CDvA39jqupYYsZNETElyKDwBaaBazMTuhauh58YFZnXviyvQ58XEZjsIRjIWgKtGRF Brf8nzgsPdN6vx474AWzCws8NrEPcvx0kbJVdwBV3Wez+zEV4Zi+txns7xLoKkKmiNch OSY4eS8Htrj/F4neOdM40ny5iwum/9lHZvzTkuj7VDHWcpgWHxB7hsnehQ8Nv/rJUQOD n2laZjqunWqbBrVi5KTdljJj5SvB+dkveipPcBckywAny/M6hHatOTy8C7MA0NIQjSd/ biyP3aSXc5fZY+RfvkVdJiZg+UcBwzykM/To2jViBOYXecAuZGBBRfXh8590KUPIXcg2 mImw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2c0H6MQZJ+aaTdxGHp3i8NRmaZkgqbpwH4VY1gWdFUs=; b=ZBuE4XXqg7UNKNuZjb2N3nGeX0AaAKROjdHw5T8IqMGLfueM2m3sk9EJS5ZhPwVOE6 J01u1fWd3i0uPHC94N66+qVIybY7+80J+FYrdkUZvW27mvULdcawI4TGaKaoe5jUSLxo fBFVFVI2fDMyik8xbhhzgmxH+8k/rjvUC+VTBD3esX2i693AEC/xACDprzWnEPYY72+v 37kkms86t4VNmPOWtzBM8+64oyUGG9JI0tIdTmjYLr5VEXa6nP8+2vGoeGprHcksIXCU irSsNJLS23vi56bbsCxdrSZ8/0mM6BiPNsvCfPibOgOhnUuLYCj2uiLZsyXIpRHZsOyt +cHw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si2614867plo.102.2018.12.13.15.01.41; Thu, 13 Dec 2018 15:01:59 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727775AbeLMXAv (ORCPT + 99 others); Thu, 13 Dec 2018 18:00:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42152 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbeLMXAv (ORCPT ); Thu, 13 Dec 2018 18:00:51 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 537873002F85; Thu, 13 Dec 2018 23:00:51 +0000 (UTC) Received: from treble (ovpn-120-195.rdu2.redhat.com [10.10.120.195]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6CAF6012D; Thu, 13 Dec 2018 23:00:47 +0000 (UTC) Date: Thu, 13 Dec 2018 17:00:45 -0600 From: Josh Poimboeuf To: Petr Mladek Cc: Jiri Kosina , Miroslav Benes , Jason Baron , Joe Lawrence , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v14 08/11] livepatch: Remove Nop structures when unused Message-ID: <20181213230045.2xgi2pyewkjbou22@treble> References: <20181129094431.7801-1-pmladek@suse.com> <20181129094431.7801-9-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181129094431.7801-9-pmladek@suse.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 13 Dec 2018 23:00:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). > + > + /* > + * Avoid double free. It would be tricky to wait for kobject > + * callbacks when only NOPs are handled. > + */ > + list_del(&func->node); I've read this comment several times but I still have no idea how it relates to the code :-) And a similar comment for __klp_free_objects(). -- Josh