linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: "Minh Bùi Quang" <minhquangbui99@gmail.com>
Cc: Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Corentin Labbe <clabbe@baylibre.com>,
	Jules Irenge <jbi.octave@gmail.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB: dummy-hcd: Fix uninitialized array use in init()
Date: Sat, 5 Dec 2020 10:15:11 -0500	[thread overview]
Message-ID: <20201205151511.GA1179536@rowland.harvard.edu> (raw)
In-Reply-To: <CACtPs=Gg3C0KxdFnETHujAyis4hhKnCdV4_ZWqprHkXCXahFvw@mail.gmail.com>

On Sat, Dec 05, 2020 at 07:47:01PM +0700, Minh Bùi Quang wrote:
> Vào Th 6, 4 thg 12, 2020 vào lúc 23:12 Alan Stern
> <stern@rowland.harvard.edu> đã viết:
> > Does this initialization end up using less memory than an explicit
> > memset() call?
> 
> You mean speed?

No, I mean memory space.

A memset call requires a certain amount of instruction space (to push 
the arguments and make the call) but no static data space.  
Initialization requires some instruction space (to copy the data) and 
static data space as well (to hold the data that is to be copied).

Alan Stern

> In my opinion, there is no difference in speed between 2 ways.
> When I compile this array initialization using gcc 5.4.0,  this
> initialization becomes
> mov instructions when MAX_NUM_UDC=2 and becomes rep stos when
> MAX_NUM_UDC=32. I think it makes no difference when comparing with memset()
> 
> Thanks,
> Quang Minh

  reply	other threads:[~2020-12-05 18:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04  6:24 [PATCH] USB: dummy-hcd: Fix uninitialized array use in init() Bui Quang Minh
2020-12-04 16:12 ` Alan Stern
2020-12-05 12:47   ` Minh Bùi Quang
2020-12-05 15:15     ` Alan Stern [this message]
2020-12-06 11:24       ` Bui Quang Minh
2020-12-06 16:07         ` Alan Stern

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=20201205151511.GA1179536@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=andreyknvl@gmail.com \
    --cc=balbi@kernel.org \
    --cc=clabbe@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jbi.octave@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=minhquangbui99@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).