* [PATCH] [net/9p] Small non-IO PDUs for zero-copy supporting transports.
@ 2011-02-17 22:12 Venkateswararao Jujjuri (JV)
2011-02-19 19:11 ` Aneesh Kumar K. V
0 siblings, 1 reply; 2+ messages in thread
From: Venkateswararao Jujjuri (JV) @ 2011-02-17 22:12 UTC (permalink / raw)
To: v9fs-developer; +Cc: linux-fsdevel, Venkateswararao Jujjuri (JV)
If a transport prefers payload to be sent separate from the PDU
(P9_TRANS_PREF_PAYLOAD_SEP), there is no need to allocate msize
PDU buffers(struct p9_fcall).
This patch allocates only upto 4k buffers for this kind of transports
and there won't be any change to the legacy transports.
Hence, this patch on top of zero copy changes allows user to
specify higher msizes through the mount option
without hogging the kernel heap.
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
---
include/net/9p/9p.h | 2 +-
net/9p/client.c | 23 +++++++++++++++++------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 7aefa6d..eaa45f9 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -688,7 +688,7 @@ struct p9_rwstat {
* @id: protocol operating identifier of type &p9_msg_t
* @tag: transaction id of the request
* @offset: used by marshalling routines to track currentposition in buffer
- * @capacity: used by marshalling routines to track total capacity
+ * @capacity: used by marshalling routines to track total malloc'd capacity
* @pubuf: Payload user buffer given by the caller
* @pubuf: Payload kernel buffer given by the caller
* @pbuf_size: pubuf/pkbuf(only one will be !NULL) size to be read/write.
diff --git a/net/9p/client.c b/net/9p/client.c
index 251abb1..43ec78a 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -229,10 +229,23 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
return ERR_PTR(-ENOMEM);
}
init_waitqueue_head(req->wq);
- req->tc = kmalloc(sizeof(struct p9_fcall)+c->msize,
- GFP_KERNEL);
- req->rc = kmalloc(sizeof(struct p9_fcall)+c->msize,
- GFP_KERNEL);
+ if ((c->trans_mod->pref & P9_TRANS_PREF_PAYLOAD_MASK) ==
+ P9_TRANS_PREF_PAYLOAD_SEP) {
+ int alloc_msize = min(c->msize, 4096);
+ req->tc = kmalloc(sizeof(struct p9_fcall)+alloc_msize,
+ GFP_KERNEL);
+ req->tc->capacity = alloc_msize;
+ req->rc = kmalloc(sizeof(struct p9_fcall)+alloc_msize,
+ GFP_KERNEL);
+ req->rc->capacity = alloc_msize;
+ } else {
+ req->tc = kmalloc(sizeof(struct p9_fcall)+c->msize,
+ GFP_KERNEL);
+ req->tc->capacity = c->msize;
+ req->rc = kmalloc(sizeof(struct p9_fcall)+c->msize,
+ GFP_KERNEL);
+ req->rc->capacity = c->msize;
+ }
if ((!req->tc) || (!req->rc)) {
printk(KERN_ERR "Couldn't grow tag array\n");
kfree(req->tc);
@@ -243,9 +256,7 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
return ERR_PTR(-ENOMEM);
}
req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall);
- req->tc->capacity = c->msize;
req->rc->sdata = (char *) req->rc + sizeof(struct p9_fcall);
- req->rc->capacity = c->msize;
}
p9pdu_reset(req->tc);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [net/9p] Small non-IO PDUs for zero-copy supporting transports.
2011-02-17 22:12 [PATCH] [net/9p] Small non-IO PDUs for zero-copy supporting transports Venkateswararao Jujjuri (JV)
@ 2011-02-19 19:11 ` Aneesh Kumar K. V
0 siblings, 0 replies; 2+ messages in thread
From: Aneesh Kumar K. V @ 2011-02-19 19:11 UTC (permalink / raw)
To: Venkateswararao Jujjuri (JV), v9fs-developer
Cc: linux-fsdevel, Venkateswararao Jujjuri (JV)
On Thu, 17 Feb 2011 14:12:41 -0800, "Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com> wrote:
> If a transport prefers payload to be sent separate from the PDU
> (P9_TRANS_PREF_PAYLOAD_SEP), there is no need to allocate msize
> PDU buffers(struct p9_fcall).
>
> This patch allocates only upto 4k buffers for this kind of transports
> and there won't be any change to the legacy transports.
>
> Hence, this patch on top of zero copy changes allows user to
> specify higher msizes through the mount option
> without hogging the kernel heap.
>
> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
> ---
> include/net/9p/9p.h | 2 +-
> net/9p/client.c | 23 +++++++++++++++++------
> 2 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
> index 7aefa6d..eaa45f9 100644
> --- a/include/net/9p/9p.h
> +++ b/include/net/9p/9p.h
> @@ -688,7 +688,7 @@ struct p9_rwstat {
> * @id: protocol operating identifier of type &p9_msg_t
> * @tag: transaction id of the request
> * @offset: used by marshalling routines to track currentposition in buffer
> - * @capacity: used by marshalling routines to track total capacity
> + * @capacity: used by marshalling routines to track total malloc'd capacity
> * @pubuf: Payload user buffer given by the caller
> * @pubuf: Payload kernel buffer given by the caller
> * @pbuf_size: pubuf/pkbuf(only one will be !NULL) size to be read/write.
> diff --git a/net/9p/client.c b/net/9p/client.c
> index 251abb1..43ec78a 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -229,10 +229,23 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
> return ERR_PTR(-ENOMEM);
> }
> init_waitqueue_head(req->wq);
> - req->tc = kmalloc(sizeof(struct p9_fcall)+c->msize,
> - GFP_KERNEL);
> - req->rc = kmalloc(sizeof(struct p9_fcall)+c->msize,
> - GFP_KERNEL);
> + if ((c->trans_mod->pref & P9_TRANS_PREF_PAYLOAD_MASK) ==
> + P9_TRANS_PREF_PAYLOAD_SEP) {
> + int alloc_msize = min(c->msize, 4096);
value 4096 should be a #define with a comment explaining how we arrived
at value 4096
> + req->tc = kmalloc(sizeof(struct p9_fcall)+alloc_msize,
> + GFP_KERNEL);
> + req->tc->capacity = alloc_msize;
> + req->rc = kmalloc(sizeof(struct p9_fcall)+alloc_msize,
> + GFP_KERNEL);
> + req->rc->capacity = alloc_msize;
> + } else {
> + req->tc = kmalloc(sizeof(struct p9_fcall)+c->msize,
> + GFP_KERNEL);
> + req->tc->capacity = c->msize;
> + req->rc = kmalloc(sizeof(struct p9_fcall)+c->msize,
> + GFP_KERNEL);
> + req->rc->capacity = c->msize;
> + }
> if ((!req->tc) || (!req->rc)) {
> printk(KERN_ERR "Couldn't grow tag array\n");
> kfree(req->tc);
> @@ -243,9 +256,7 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
> return ERR_PTR(-ENOMEM);
> }
> req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall);
> - req->tc->capacity = c->msize;
> req->rc->sdata = (char *) req->rc + sizeof(struct p9_fcall);
> - req->rc->capacity = c->msize;
> }
>
> p9pdu_reset(req->tc);
-aneesh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-02-19 19:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-17 22:12 [PATCH] [net/9p] Small non-IO PDUs for zero-copy supporting transports Venkateswararao Jujjuri (JV)
2011-02-19 19:11 ` Aneesh Kumar K. V
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).