All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Parri <andrea.parri@amarulasolutions.com>
To: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: Josh Triplett <josh@joshtriplett.org>,
	tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com,
	linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:core/rcu] rcutorture: Make initrd/init execute in userspace
Date: Thu, 6 Dec 2018 01:51:47 +0100	[thread overview]
Message-ID: <20181206005147.GA3300@andrea> (raw)
In-Reply-To: <20181206000809.GX4170@linux.ibm.com>

> commit 4f8f751961b536f77c8f82394963e8e2d26efd84
> Author: Paul E. McKenney <paulmck@linux.ibm.com>
> Date:   Tue Dec 4 14:59:12 2018 -0800
> 
>     torture: Explain and simplify odd "for" loop in mkinitrd.sh
>     
>     Why a Bourne-shell "for" loop?  And why 192 instances of "a"?  This commit
>     adds a shell comment to present the answer to these mysteries.  It also
>     uses a series of factor-of-four Bourne-shell assignments to make it
>     easy to see how many instances there are, replacing the earlier wall of
>     'a' characters.
>     
>     Reported-by: Josh Triplett <josh@joshtriplett.org>
>     Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
> 
> diff --git a/tools/testing/selftests/rcutorture/bin/mkinitrd.sh b/tools/testing/selftests/rcutorture/bin/mkinitrd.sh
> index da298394daa2..ff69190604ea 100755
> --- a/tools/testing/selftests/rcutorture/bin/mkinitrd.sh
> +++ b/tools/testing/selftests/rcutorture/bin/mkinitrd.sh
> @@ -40,17 +40,24 @@ mkdir $T
>  cat > $T/init << '__EOF___'
>  #!/bin/sh
>  # Run in userspace a few milliseconds every second.  This helps to
> -# exercise the NO_HZ_FULL portions of RCU.
> +# exercise the NO_HZ_FULL portions of RCU.  The 192 instances of "a" was
> +# empirically shown to give a nice multi-millisecond burst of user-mode
> +# execution on a 2GHz CPU, as desired.  Modern CPUs will vary from a
> +# couple of milliseconds up to perhaps 100 milliseconds, which is an
> +# acceptable range.
> +#
> +# Why not calibrate an exact delay?  Because within this initrd, we
> +# are restricted to Bourne-shell builtins, which as far as I know do not
> +# provide any means of obtaining a fine-grained timestamp.
> +
> +a4="a a a a"
> +a16="$a4 $a4 $a4 $a4"
> +a64="$a8 $a8 $a8 $a8"

Mmh, are you sure you don't want s/a8/a16/ here? ;-)

  Andrea


> +a192="$a64 $a64 $a64"
>  while :
>  do
>  	q=
> -	for i in \
> -		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> -		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> -		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> -		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> -		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> -		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
> +	for i in $a192
>  	do
>  		q="$q $i"
>  	done
> 

  parent reply	other threads:[~2018-12-06  0:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tip-229ab0cb5be3bfbac5947df7240f6905470ca413@git.kernel.org>
2018-12-04 22:24 ` [tip:core/rcu] rcutorture: Make initrd/init execute in userspace Josh Triplett
2018-12-04 23:04   ` Paul E. McKenney
2018-12-05 22:25     ` Josh Triplett
2018-12-06  0:08       ` Paul E. McKenney
2018-12-06  0:27         ` Josh Triplett
2018-12-06  1:04           ` Paul E. McKenney
2018-12-06  0:51         ` Andrea Parri [this message]
2018-12-06  0:58           ` Josh Triplett
2018-12-06  1:06             ` Paul E. McKenney
2018-12-06  1:05           ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181206005147.GA3300@andrea \
    --to=andrea.parri@amarulasolutions.com \
    --cc=hpa@zytor.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.ibm.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.