From: "Aurélien Aptel" <aaptel-IBi9RG/b67k@public.gmane.org>
To: Ronnie Sahlberg
<lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
linux-cifs <linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 01/19] cifs: Add SendReceive3
Date: Thu, 02 Nov 2017 15:14:26 +0100 [thread overview]
Message-ID: <87o9okvkcd.fsf@suse.com> (raw)
In-Reply-To: <20171102070312.18903-2-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Ronnie Sahlberg <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> writes:
> +
> + new_iov = kmalloc(sizeof(struct kvec) * (n_vec + 1), GFP_KERNEL);
> + if (!new_iov)
> + return -ENOMEM;
> +
> + /* 1st iov is an RFC1002 Session Message length */
> + memcpy(new_iov + 1, iov, (sizeof(struct kvec) * n_vec));
> +
> + count = 0;
> + for (i = 1; i < n_vec + 1; i++)
> + count += new_iov[i].iov_len;
> +
> + rfc1002_marker = cpu_to_be32(count);
> +
> + new_iov[0].iov_base = &rfc1002_marker;
> + new_iov[0].iov_len = 4;
> +
> + memset(&rqst, 0, sizeof(struct smb_rqst));
> + rqst.rq_iov = new_iov;
> + rqst.rq_nvec = n_vec + 1;
> +
> + rc = cifs_send_recv(xid, ses, &rqst, resp_buf_type, flags, resp_iov);
> + kfree(new_iov);
> + return rc;
> +}
> +
I know this is kind of unrelated but I've been thinking to myself we
should try to get rid of this dynamic allocation at some point.
IIUC the iovec never has more than a couple of elements, so we could
have something like a fixed sized stack allocated iovec array +
MAX_IOVEC_LENGTH macro.
Doing a kmalloc() for every packet defeats the purpose of the memory
pool optimization we use for small/large buffers.
--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2017-11-02 14:14 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-02 7:02 [PATCH 00/19] cifs: remove rfc1002 header from all smb2 requests Ronnie Sahlberg
[not found] ` <20171102070312.18903-1-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-02 7:02 ` [PATCH 01/19] cifs: Add SendReceive3 Ronnie Sahlberg
[not found] ` <20171102070312.18903-2-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-02 14:14 ` Aurélien Aptel [this message]
[not found] ` <87o9okvkcd.fsf-IBi9RG/b67k@public.gmane.org>
2017-11-03 6:25 ` Christoph Hellwig
2017-11-03 6:27 ` Christoph Hellwig
[not found] ` <20171103062715.GB8075-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2017-11-03 6:37 ` ronnie sahlberg
[not found] ` <CAN05THS8m9Z=KwiGarKh4qJT-X_ZnYU_AqVe26NNtF3Ad9j5nQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-03 13:36 ` Christoph Hellwig
2017-11-02 7:02 ` [PATCH 02/19] cifs: remove rfc1002 header from smb2_negotiate_req Ronnie Sahlberg
2017-11-02 7:02 ` [PATCH 03/19] cifs: remove rfc1002 header from smb2_logoff_req Ronnie Sahlberg
2017-11-02 7:02 ` [PATCH 04/19] cifs: remove rfc1002 header from smb2_tree_disconnect_req Ronnie Sahlberg
2017-11-02 7:02 ` [PATCH 05/19] cifs: remove rfc1002 header from smb2_close_req Ronnie Sahlberg
2017-11-02 7:02 ` [PATCH 06/19] cifs: remove rfc1002 header from smb2_ioctl_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 07/19] cifs: remove rfc1002 header from smb2_echo_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 08/19] cifs: remove rfc1002 header from smb2_sess_setup_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 09/19] cifs: remove rfc1002 header from smb2_tree_connect_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 10/19] cifs: remove rfc1002 header from smb2_create_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 11/19] cifs: remove rfc1002 header from smb2_flush_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 12/19] cifs: remove rfc1002 header from smb2_lock_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 13/19] cifs: remove rfc1002 header from smb2 read/write requests Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 14/19] cifs: remove rfc1002 header from smb2_lease_ack Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 15/19] cifs: remove rfc1002 header from smb2_oplock_break we get from server Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 16/19] cifs: remove rfc1002 header from smb2_set_info_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 17/19] cifs: remove rfc1002 header from smb2_query_directory_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 18/19] cifs: remove rfc1002 header from smb2_query_info_req Ronnie Sahlberg
2017-11-02 7:03 ` [PATCH 19/19] cifs: remove small_smb2_init Ronnie Sahlberg
2017-11-08 14:38 ` [PATCH 00/19] cifs: remove rfc1002 header from all smb2 requests Aurélien Aptel
[not found] ` <87r2t8j0nc.fsf-IBi9RG/b67k@public.gmane.org>
2017-11-08 15:46 ` Aurélien Aptel
[not found] ` <87o9ocixio.fsf-IBi9RG/b67k@public.gmane.org>
2017-11-09 0:48 ` ronnie sahlberg
[not found] ` <CAN05THRX2dDBVA7+aCYnatYpm0EEH=iPdcwE40BSROOPmCPkcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-17 1:16 ` Pavel Shilovsky
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=87o9okvkcd.fsf@suse.com \
--to=aaptel-ibi9rg/b67k@public.gmane.org \
--cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox