Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1396922

Re: [Xen-devel] [PATCH 1/1] xen/gntdev: kmalloc structure gntdev_copy_batch

From David Vrabel <david.vrabel@citrix.com>
Newsgroups linux.kernel
Subject Re: [Xen-devel] [PATCH 1/1] xen/gntdev: kmalloc structure gntdev_copy_batch
Date 2016-05-09 12:40 +0200
Message-ID <rwQLw-3GP-21@gated-at.bofh.it> (permalink)
References <rw5CV-6kg-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 07/05/16 09:17, Heinrich Schuchardt wrote:
> Commit a4cdb556cae0 ("xen/gntdev: add ioctl for grant copy")
> leads to a warning
> xen/gntdev.c: In function ‘gntdev_ioctl_grant_copy’:
> xen/gntdev.c:949:1: warning: the frame size of 1248 bytes
> is larger than 1024 bytes [-Wframe-larger-than=]
> 
> This can be avoided by using kmalloc instead of the stack.
> 
> Testing requires CONFIG_XEN_GNTDEV.

Thanks, but I've applied the following patch instead.

David

8<-------------
xen/gntdev: reduce copy batch size to 16

IOCTL_GNTDEV_GRANT_COPY batches copy operations to reduce the number
of hypercalls.  The stack is used to avoid a memory allocation in a
hot path. However, a batch size of 24 requires more than 1024 bytes of
stack which in some configurations causes a compiler warning.

    xen/gntdev.c: In function ‘gntdev_ioctl_grant_copy’:
    xen/gntdev.c:949:1: warning: the frame size of 1248 bytes is
    larger than 1024 bytes [-Wframe-larger-than=]

This is a harmless warning as there is still plenty of stack spare,
but people keep trying to "fix" it.  Reduce the batch size to 16 to
reduce stack usage to less than 1024 bytes.  This should have minimal
impact on performance.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
 drivers/xen/gntdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index dc49538..6793957 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -748,7 +748,7 @@ static long gntdev_ioctl_notify(struct gntdev_priv
*priv, void __user *u)
 	return rc;
 }

-#define GNTDEV_COPY_BATCH 24
+#define GNTDEV_COPY_BATCH 16

 struct gntdev_copy_batch {
 	struct gnttab_copy ops[GNTDEV_COPY_BATCH];
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] xen/gntdev: kmalloc structure gntdev_copy_batch Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-05-07 10:20 +0200
  Re: [PATCH 1/1] xen/gntdev: kmalloc structure gntdev_copy_batch Juergen Gross <jgross@suse.com> - 2016-05-09 07:30 +0200
  Re: [Xen-devel] [PATCH 1/1] xen/gntdev: kmalloc structure  gntdev_copy_batch "Jan Beulich" <jbeulich@suse.com> - 2016-05-09 08:10 +0200
  Re: [Xen-devel] [PATCH 1/1] xen/gntdev: kmalloc structure  gntdev_copy_batch David Vrabel <david.vrabel@citrix.com> - 2016-05-09 12:40 +0200

csiph-web