Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754810AbdGSPGe (ORCPT ); Wed, 19 Jul 2017 11:06:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:37395 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752973AbdGSPGd (ORCPT ); Wed, 19 Jul 2017 11:06:33 -0400 Date: Wed, 19 Jul 2017 17:06:30 +0200 From: Petr Mladek To: Joe Lawrence Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , Jessica Yu , Jiri Kosina , Miroslav Benes Subject: Re: [PATCH v2 2/2] livepatch: add shadow variable sample programs Message-ID: <20170719150630.GK32632@pathway.suse.cz> References: <1498664247-12296-1-git-send-email-joe.lawrence@redhat.com> <1498664247-12296-3-git-send-email-joe.lawrence@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1498664247-12296-3-git-send-email-joe.lawrence@redhat.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: 1185 Lines: 37 On Wed 2017-06-28 11:37:27, Joe Lawrence wrote: > Add sample livepatch modules to demonstrate the shadow variable API. > > Signed-off-by: Joe Lawrence > --- > diff --git a/samples/livepatch/livepatch-shadow-mod.c b/samples/livepatch/livepatch-shadow-mod.c > new file mode 100644 > index 000000000000..423f4b7b0adb > --- /dev/null > +++ b/samples/livepatch/livepatch-shadow-mod.c > + > +#define T1_PERIOD 1 /* allocator thread */ > +#define T2_PERIOD (3 * T1_PERIOD) /* cleanup thread */ > + > + > + /* Dummies live long enough to see a few t2 instances */ > + d->jiffies_expire = jiffies + 1000 * 4 * T2_PERIOD; One more thing that I realized later. This will depend on HZ. Also above defined periods are later multiplied by 4 or 2 so that it is not easy to understand and tune. I would suggest to define the exact periods in ms on one location: #define ALLOC_PERIOD_MSEC 10 #define FREE_PERIOD_MSEC (6 * ALLOC_PERIOD_MSEC) #define EXPIRE_PERIOD_MSEC (24 * ALLOC_PERION_MSEC) and then use msec_to_jiffies(XXX_PERIOD_MSEC) on the respective locations. Huh, I should reduce my alarm level. This is just an example code after all. Best Regards, Petr