From: Johannes Thumshirn <jthumshirn@suse.de>
To: SF Markus Elfring <elfring@users.sourceforge.net>,
linux-rdma@vger.kernel.org,
Dennis Dalessandro <dennis.dalessandro@intel.com>,
Doug Ledford <dledford@redhat.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
Mike Marciniszyn <mike.marciniszyn@intel.com>,
Sean Hefty <sean.hefty@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 3/5] IB/hfi1: Adjust another size determination in hfi1_user_sdma_alloc_queues()
Date: Mon, 13 Feb 2017 10:10:37 +0100 [thread overview]
Message-ID: <fc714096-8534-2231-17fd-8e3ca3f7a87b@suse.de> (raw)
In-Reply-To: <0fdf4d81-58d7-c6fc-b37f-41d47675dd83@users.sourceforge.net>
On 02/10/2017 10:03 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 10 Feb 2017 08:50:45 +0100
>
> * Pass a product for a call of the function "vmalloc_user" without storing
> it in an intermediate variable.
>
> * Delete the local variable "memsize" which became unnecessary with
> this refactoring.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/infiniband/hw/hfi1/user_sdma.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c
> index 15194554a92b..991e7f3d8e18 100644
> --- a/drivers/infiniband/hw/hfi1/user_sdma.c
> +++ b/drivers/infiniband/hw/hfi1/user_sdma.c
> @@ -375,7 +375,6 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp)
> {
> struct hfi1_filedata *fd;
> int ret = 0;
> - unsigned memsize;
> char buf[64];
> struct hfi1_devdata *dd;
> struct hfi1_user_sdma_comp_q *cq;
> @@ -443,8 +442,8 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp)
> if (!cq)
> goto cq_nomem;
>
> - memsize = PAGE_ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size);
> - cq->comps = vmalloc_user(memsize);
> + cq->comps = vmalloc_user(PAGE_ALIGN(sizeof(*cq->comps)
> + * hfi1_sdma_comp_ring_size));
> if (!cq->comps)
> goto cq_comps_nomem;
>
>
IMHO this makes readability worse. What's the intention behind this
patch? Is there any difference in binary size or something in the likes?
I doubt so as the compiler should take care of this anyways.
I'm just a casual reader of the RDMA list not an active reviewer, but if
you did this in e.g. SCSI I'd NACK it. Code has to be readable for
humans and that means the less that's done in one line of code the
better. Let the compiler do the optimizations and get rid of local
variables.
Just my 2c.
Byte,
Johannes
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
next prev parent reply other threads:[~2017-02-13 9:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-10 21:00 [PATCH 0/5] IB/hfi1: Fine-tuning for three function implementations SF Markus Elfring
2017-02-10 21:01 ` [PATCH 1/5] IB/hfi1: Use kcalloc() in hfi1_user_exp_rcv_init() SF Markus Elfring
2017-02-10 21:02 ` [PATCH 2/5] IB/hfi1: Use kcalloc() in hfi1_user_sdma_alloc_queues() SF Markus Elfring
2017-02-10 21:03 ` [PATCH 3/5] IB/hfi1: Adjust another size determination " SF Markus Elfring
2017-02-13 9:10 ` Johannes Thumshirn [this message]
2017-02-13 9:32 ` SF Markus Elfring
2017-02-13 9:51 ` Johannes Thumshirn
2017-02-13 10:37 ` SF Markus Elfring
2017-02-13 10:49 ` Johannes Thumshirn
2017-02-10 21:04 ` [PATCH 4/5] IB/hfi1: Use memdup_user() rather than duplicating its implementation in hfi1_user_sdma_process_request() SF Markus Elfring
2017-02-11 15:32 ` Dennis Dalessandro
2017-02-13 9:50 ` [PATCH 27/27] IB/hfi1: Code reuse with memdup_copy SF Markus Elfring
2017-02-13 10:53 ` [PATCH 4/5] IB/hfi1: Use memdup_user() rather than duplicating its implementation in hfi1_user_sdma_process_request() Dan Carpenter
2017-02-13 11:12 ` SF Markus Elfring
2017-02-13 14:01 ` Dan Carpenter
2017-02-10 21:05 ` [PATCH 5/5] IB/hfi1: Improve another size determination " SF Markus Elfring
2017-04-20 20:29 ` [PATCH 0/5] IB/hfi1: Fine-tuning for three function implementations Doug Ledford
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=fc714096-8534-2231-17fd-8e3ca3f7a87b@suse.de \
--to=jthumshirn@suse.de \
--cc=dennis.dalessandro@intel.com \
--cc=dledford@redhat.com \
--cc=elfring@users.sourceforge.net \
--cc=hal.rosenstock@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mike.marciniszyn@intel.com \
--cc=sean.hefty@intel.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
all inboxes | Powered by JetHome®