Received: by 10.213.65.68 with SMTP id h4csp42204imn; Fri, 6 Apr 2018 15:11:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/R2axv5llP4C4n8twXlW1gXrYloDL23J+K9zh0tJOUOfVWOMxb4UtKFraUo1If2KQFDTt8 X-Received: by 10.98.80.5 with SMTP id e5mr21779618pfb.131.1523052676181; Fri, 06 Apr 2018 15:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523052676; cv=none; d=google.com; s=arc-20160816; b=p/jrasSv9Hh4TPWSqwxipyoWYED8FaRKXiW/UqModEzXueWqhY5hueyy1rOZTpEQUT uAIv6NMk3HoJJe92lhm6tKISDnOyvU6xBxpzuy5aiR5Cgebl4wiNEOKBUnNRBnajSwD+ Lz5cB4tgQwlsp5b6Bn4w1HqmsWXws73w25c5SkmUPH1wUBinCI0r3wo22CM795GrTW7n TQ8ZkhKBVx3iGXyQFWa8uKWqwL0idwMMwQBdtMwy7Pis1YYQ0EnDi3YxWW4p3XHD4Iwd iQz06vGw3hyrTxUt0vZQ2D1oWRwW6QXYT2ZDp+MIjIRN4r+hkO84dkxE9yau+zqd+yvV weSw== 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:arc-authentication-results; bh=rFkhGkJ++EIptrR7KBCzsP/KaRnIGa9qpAVeX7GOzRA=; b=Ofyp+P9cb0m3iVVGuNwLUgNbSuIC6h1EFAVbVwL4LvEnw8U+hp/GJGO29mB3A2ognq SCY9OU0OONhW26YzermGJXT11ti670kMtGYU0irz1/GG6vgV/A+A/gj3D5Dq8nEEUhGp R7i4q1VRMt+TowffBi0t3ja/3Nf2dDiWaAxu+kxU9ji729j8KjuedSR3Duk8rF05bGNW vxfzmWu0QoV4T9T9LemlPCjBMtSXYoOKeY3vSa3P3h2/e0uXj9GMHU+SOJ2PkiAIYB4v FGaLf/JAKqa4IP1ZLbWGgBdAed36RUGrNAUwkMQNtCF3/oIDdn9lM8P1gIDRoshrvh7H r2mA== 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 r11-v6si9508583pls.579.2018.04.06.15.10.39; Fri, 06 Apr 2018 15:11:16 -0700 (PDT) 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 S1752401AbeDFWH2 (ORCPT + 99 others); Fri, 6 Apr 2018 18:07:28 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:32882 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751488AbeDFWH1 (ORCPT ); Fri, 6 Apr 2018 18:07:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A2C504068027; Fri, 6 Apr 2018 22:07:26 +0000 (UTC) Received: from treble (ovpn-120-110.rdu2.redhat.com [10.10.120.110]) by smtp.corp.redhat.com (Postfix) with SMTP id 0DDE4AFD70; Fri, 6 Apr 2018 22:07:24 +0000 (UTC) Date: Fri, 6 Apr 2018 17:07:23 -0500 From: Josh Poimboeuf To: Petr Mladek Cc: Jiri Kosina , Miroslav Benes , Jason Baron , Joe Lawrence , Jessica Yu , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/8] livepatch: Remove Nop structures when unused Message-ID: <20180406220723.t3bsb6j7w4lf3wbb@treble> References: <20180323120028.31451-1-pmladek@suse.com> <20180323120028.31451-7-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180323120028.31451-7-pmladek@suse.com> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 06 Apr 2018 22:07:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 06 Apr 2018 22:07:26 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jpoimboe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 23, 2018 at 01:00:26PM +0100, Petr Mladek wrote: > Replaced patches are removed from the stack when the transition is > finished. It means that Nop structures will never be needed again > and can be removed. Why should we care? Warning, grammar pedantry ahead. "Nop" isn't a proper noun, so it shouldn't be capitalized (here and in the patch subject). Also, "NOP", used elsewhere, might be confused with x86 NOP instructions. I would vote for "nop" everywhere. > @@ -146,6 +155,21 @@ static void klp_complete_transition(void) > if (!klp_forced && klp_target_state == KLP_UNPATCHED) > module_put(klp_transition_patch->mod); > > + if (klp_transition_patch->replace && klp_target_state == KLP_PATCHED) { > + /* > + * We do not need to wait until the objects are really freed. > + * We will never need them again because the patch must be on > + * the bottom of the stack now. > + */ > + klp_free_objects_dynamic(klp_transition_patch); > + /* > + * Replace behavior will not longer be needed. Avoid the related > + * code when disabling and enabling again. "not longer" -> "no longer" -- Josh