Web lists-archives.com

[PATCH 1/1] splice: Reduce stack usage by reducing structure partial_page




u16 can be used to store Page offset and page len for partial page
for page size upto 65K. page size is fixed at compilation time so
size of partial page can be reduced to reduce stack usage of functions
using partial_page structure on stack.

<subbuf_splice_actor>:
       e16d42f4        strd    r4, [sp, #-36]! ; 0xffffffdc
...
       e24ddf4d        sub     sp, sp, #308    ; 0x134

<tracing_splice_read_pipe>:
       e16d42f4        strd    r4, [sp, #-36]! ; 0xffffffdc
...
       e24ddf53        sub     sp, sp, #332    ; 0x14c

After:
======
<subbuf_splice_actor>:                                           
       e16d42f4        strd    r4, [sp, #-36]! ; 0xffffffdc      
...            
       e24dd0f4        sub     sp, sp, #244    ; 0xf4  

<tracing_splice_read_pipe>:
       e16d42f4        strd    r4, [sp, #-36]! ; 0xffffffdc
...
       e24ddf45        sub     sp, sp, #276    ; 0x114

Tested on ARM.

Signed-off-by: Vaneet Narang <v.narang@xxxxxxxxxxx>
Signed-off-by: Maninder Singh <maninder1.s@xxxxxxxxxxx>
---
 include/linux/splice.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/splice.h b/include/linux/splice.h
index 74b4911..d2b1814 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -45,8 +45,13 @@ struct splice_desc {
 };
 
 struct partial_page {
+#if PAGE_SHIFT < 16
+	unsigned short offset;
+	unsigned short len;
+#else
 	unsigned int offset;
 	unsigned int len;
+#endif
 	unsigned long private;
 };
 
-- 
2.7.4