public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Julian Wiedmann <jwi@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, Karsten Graul <kgraul@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 1/6] s390/ctcm: Put struct th_header and th_sweep on stack.
Date: Thu, 19 Nov 2020 09:12:48 +0100	[thread overview]
Message-ID: <20201119081248.iyb2dxeazgm3fhyg@linutronix.de> (raw)
In-Reply-To: <88ac2454-32f4-f48b-f255-b23aedabc45b@linux.ibm.com>

On 2020-11-19 09:45:08 [+0200], Julian Wiedmann wrote:
> On 18.11.20 12:53, Sebastian Andrzej Siewior wrote:
> > The size of struct th_header is 8 byte and the size of struct th_sweep
> > is 16 byte. The memory for is allocated, initialized, used and
> > deallocated a few lines later.
> > 
> > It is more efficient to avoid the allocation/free dance and keeping the
> > variable on stack. Especially since the compiler is smart enough to not
> > allocate the memory on stack but assign the values directly.
> > 
> > Declare struct th_sweep/th_header on stack and initialize it to zero.
> > Use the local variable instead of the pointer.
> > 
> 
> Frankly, I'd much rather see us use the pointers that are returned from
> skb_push() and skb_put(). No need for the on-stack & memcpy indirection.

You are aware that the compiler optimizes the on-stack memory away and
you get the zero-init for free due to the way the assignment is made?
There is no memcpy() in the resulting code.

Sebastian

  reply	other threads:[~2020-11-19  8:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 10:53 [PATCH 0/6] s390/ctcm: Remove gfp_type() usage Sebastian Andrzej Siewior
2020-11-18 10:53 ` [PATCH 1/6] s390/ctcm: Put struct th_header and th_sweep on stack Sebastian Andrzej Siewior
2020-11-19  7:45   ` Julian Wiedmann
2020-11-19  8:12     ` Sebastian Andrzej Siewior [this message]
2020-11-19  8:16       ` Julian Wiedmann
2020-11-19  9:37         ` Sebastian Andrzej Siewior
2020-11-18 10:53 ` [PATCH 2/6] s390/ctcm: Put struct qllc " Sebastian Andrzej Siewior
2020-11-19  7:56   ` Julian Wiedmann
2020-11-18 10:53 ` [PATCH 3/6] s390/ctcm: Put struct pdu " Sebastian Andrzej Siewior
2020-11-19  7:52   ` Julian Wiedmann
2020-11-18 10:53 ` [PATCH 4/6] s390/ctcm: Use explicit allocation mask in ctcmpc_unpack_skb() Sebastian Andrzej Siewior
2020-11-19  7:28   ` Julian Wiedmann
2020-11-18 10:53 ` [PATCH 5/6] s390/ctcm: Use GFP_KERNEL in add_channel() Sebastian Andrzej Siewior
2020-11-19  7:30   ` Julian Wiedmann
2020-11-18 10:53 ` [PATCH 6/6] s390/ctcm: Use GFP_ATOMIC in ctcmpc_tx() Sebastian Andrzej Siewior
2020-11-19  7:34   ` Julian Wiedmann
2020-11-19  8:01 ` [PATCH 0/6] s390/ctcm: Remove gfp_type() usage Julian Wiedmann

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=20201119081248.iyb2dxeazgm3fhyg@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=borntraeger@de.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=jwi@linux.ibm.com \
    --cc=kgraul@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox