All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Austin Kim <austindh.kim@gmail.com>
Cc: will@kernel.org, catalin.marinas@arm.com,
	linux-kernel@vger.kernel.org, austin.kim@lge.com,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] KVM: arm64: vgic: declear local variable 'flags' before for loop starts
Date: Sat, 12 Jun 2021 12:10:43 +0100	[thread overview]
Message-ID: <87eed7tk24.wl-maz@kernel.org> (raw)
In-Reply-To: <20210612110014.GA1211@raspberrypi>

On Sat, 12 Jun 2021 12:00:14 +0100,
Austin Kim <austindh.kim@gmail.com> wrote:
> 
> From: Austin Kim <austin.kim@lge.com>
> 
> Normally local variable 'flags' is defined out of for loop,
> when 'flags' is used as the second parameter in a call to
> spinlock_irq[save/restore] function.
> 
> So it had better declear local variable 'flags' ahead of for loop.

Why better? Reducing the scope of a variable is in general good
practice. Do you see any material advantage in moving this variable
out of the loop? Does the compiler generate better code?

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Austin Kim <austindh.kim@gmail.com>
Cc: james.morse@arm.com, alexandru.elisei@arm.com,
	suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
	austin.kim@lge.com
Subject: Re: [PATCH] KVM: arm64: vgic: declear local variable 'flags' before for loop starts
Date: Sat, 12 Jun 2021 12:10:43 +0100	[thread overview]
Message-ID: <87eed7tk24.wl-maz@kernel.org> (raw)
In-Reply-To: <20210612110014.GA1211@raspberrypi>

On Sat, 12 Jun 2021 12:00:14 +0100,
Austin Kim <austindh.kim@gmail.com> wrote:
> 
> From: Austin Kim <austin.kim@lge.com>
> 
> Normally local variable 'flags' is defined out of for loop,
> when 'flags' is used as the second parameter in a call to
> spinlock_irq[save/restore] function.
> 
> So it had better declear local variable 'flags' ahead of for loop.

Why better? Reducing the scope of a variable is in general good
practice. Do you see any material advantage in moving this variable
out of the loop? Does the compiler generate better code?

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Austin Kim <austindh.kim@gmail.com>
Cc: james.morse@arm.com, alexandru.elisei@arm.com,
	suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
	austin.kim@lge.com
Subject: Re: [PATCH] KVM: arm64: vgic: declear local variable 'flags' before for loop starts
Date: Sat, 12 Jun 2021 12:10:43 +0100	[thread overview]
Message-ID: <87eed7tk24.wl-maz@kernel.org> (raw)
In-Reply-To: <20210612110014.GA1211@raspberrypi>

On Sat, 12 Jun 2021 12:00:14 +0100,
Austin Kim <austindh.kim@gmail.com> wrote:
> 
> From: Austin Kim <austin.kim@lge.com>
> 
> Normally local variable 'flags' is defined out of for loop,
> when 'flags' is used as the second parameter in a call to
> spinlock_irq[save/restore] function.
> 
> So it had better declear local variable 'flags' ahead of for loop.

Why better? Reducing the scope of a variable is in general good
practice. Do you see any material advantage in moving this variable
out of the loop? Does the compiler generate better code?

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2021-06-12 11:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-12 11:00 [PATCH] KVM: arm64: vgic: declear local variable 'flags' before for loop starts Austin Kim
2021-06-12 11:00 ` Austin Kim
2021-06-12 11:00 ` Austin Kim
2021-06-12 11:10 ` Marc Zyngier [this message]
2021-06-12 11:10   ` Marc Zyngier
2021-06-12 11:10   ` Marc Zyngier
2021-06-12 13:32   ` Austin Kim
2021-06-12 13:32     ` Austin Kim
2021-06-12 13:32     ` Austin Kim

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=87eed7tk24.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=austin.kim@lge.com \
    --cc=austindh.kim@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.org \
    /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.