public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Namjae Jeon <namjae.jeon@samsung.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-cifs@vger.kernel.org,
	linux-cifsd-devel@lists.sourceforge.net, smfrench@gmail.com,
	hyc.lee@gmail.com, viro@zeniv.linux.org.uk, hch@lst.de,
	hch@infradead.org, ronniesahlberg@gmail.com,
	aurelien.aptel@gmail.com, aaptel@suse.com, sandeen@sandeen.net,
	dan.carpenter@oracle.com, colin.king@canonical.com,
	rdunlap@infradead.org, Steve French <stfrench@microsoft.com>
Subject: Re: [PATCH 3/5] cifsd: add file operations
Date: Tue, 23 Mar 2021 09:05:51 +0900	[thread overview]
Message-ID: <YFkw3yabfNCXuO05@google.com> (raw)
In-Reply-To: <20210322170916.GS1719932@casper.infradead.org>

On (21/03/22 17:09), Matthew Wilcox wrote:
> On Mon, Mar 22, 2021 at 06:03:21PM +0900, Sergey Senozhatsky wrote:
> > On (21/03/22 08:15), Matthew Wilcox wrote:
> > > 
> > > What's the scenario for which your allocator performs better than slub
> > > 
> > 
> > IIRC request and reply buffers can be up to 4M in size. So this stuff
> > just allocates a number of fat buffers and keeps them around so that
> > it doesn't have to vmalloc(4M) for every request and every response.
> 
> Hang on a minute, this speaks to a deeper design problem.  If we're doing
> a 'request' or 'reply' that is that large, the I/O should be coming from
> or going to the page cache.  If it goes via a 4MB virtually contiguous
> buffer first, that's a memcpy that could/should be avoided.

But huge vmalloc buffers are still needed. For instance, `ls -la` in
a directory with a huge number of entries.

> But now i'm looking for how ksmbd_find_buffer() is used, and it isn't.
> So it looks like someone came to the same conclusion I did, but forgot
> to delete the wm code.

Yes, I think it's disabled by default and requires some smb.conf
configuration. So I guess that wm code can be removed. Especially given
that

> That said, there are plenty of opportunities to optimise the vmalloc code,
> and that's worth pursuing.

That would be really interesting to see!

> And here's the receive path which contains
> the memcpy that should be avoided (ok, it's actually the call to ->read;
> we shouldn't be reading in the entire 4MB but rather the header):

> +		conn->request_buf = ksmbd_alloc_request(size);
> +		if (!conn->request_buf)
> +			continue;
> +
> +		memcpy(conn->request_buf, hdr_buf, sizeof(hdr_buf));
> +		if (!ksmbd_smb_request(conn))
> +			break;
> +
> +		/*
> +		 * We already read 4 bytes to find out PDU size, now
> +		 * read in PDU
> +		 */
> +		size = t->ops->read(t, conn->request_buf + 4, pdu_size);


// A side note, it seems that the maximum read/write/trans buffer size that
// windows supports is 8MB, not 4MB.

  reply	other threads:[~2021-03-23  0:06 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210322052203epcas1p21fe2d04c4df5396c466c38f4d57d8bb8@epcas1p2.samsung.com>
2021-03-22  5:13 ` [PATCH 0/5] cifsd: introduce new SMB3 kernel server Namjae Jeon
2021-03-22  5:13   ` [PATCH 1/5] cifsd: add server handler and tranport layers Namjae Jeon
2021-03-22 22:18     ` Matthew Wilcox
2021-03-23  3:01       ` Namjae Jeon
2021-03-23  3:12         ` Matthew Wilcox
2021-03-23  3:16           ` Namjae Jeon
2021-03-22  5:13   ` [PATCH 2/5] cifsd: add server-side procedures for SMB3 Namjae Jeon
2021-03-22  6:47     ` Dan Carpenter
2021-03-22  6:50       ` Christoph Hellwig
2021-03-22 13:25         ` [Linux-cifsd-devel] " Stefan Metzmacher
2021-03-22 23:20         ` Namjae Jeon
2021-03-22 23:17       ` Namjae Jeon
2021-03-23  7:19         ` Dan Carpenter
2021-03-25  5:25           ` Sebastian Gottschall
2021-03-22  8:34     ` Matthew Wilcox
2021-03-22 10:27       ` Sergey Senozhatsky
2021-03-22 13:12         ` Matthew Wilcox
2021-03-22  5:13   ` [PATCH 3/5] cifsd: add file operations Namjae Jeon
2021-03-22  6:55     ` Al Viro
2021-03-23  0:12       ` Namjae Jeon
2021-03-22  7:02     ` Al Viro
2021-03-22  9:26       ` Sergey Senozhatsky
2021-03-22  7:04     ` Dan Carpenter
2021-03-22  9:39       ` Sergey Senozhatsky
2021-03-22  8:15     ` Matthew Wilcox
2021-03-22  9:03       ` Sergey Senozhatsky
2021-03-22 13:02         ` Matthew Wilcox
2021-03-22 13:57         ` Christoph Hellwig
2021-03-22 14:40           ` Matthew Wilcox
2021-03-22 17:09         ` Matthew Wilcox
2021-03-23  0:05           ` Sergey Senozhatsky [this message]
2021-03-22 16:16     ` Schaufler, Casey
2021-03-23  0:21       ` Namjae Jeon
2021-03-22  5:13   ` [PATCH 4/5] cifsd: add Kconfig and Makefile Namjae Jeon
2021-03-22  5:13   ` [PATCH 5/5] MAINTAINERS: add cifsd kernel server Namjae Jeon

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=YFkw3yabfNCXuO05@google.com \
    --to=senozhatsky@chromium.org \
    --cc=aaptel@suse.com \
    --cc=aurelien.aptel@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=dan.carpenter@oracle.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=hyc.lee@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-cifsd-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    --cc=rdunlap@infradead.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=sandeen@sandeen.net \
    --cc=smfrench@gmail.com \
    --cc=stfrench@microsoft.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.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