Skip to contentSkip to conversation

direct-io: Deinline submit_page_section, save 5304 bytes

PATCH NAK Denys Vlasenko 2 participants 6 messages Mar 13, 2016 – Mar 14, 2016 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 direct-io: Deinline submit_page_section, save 5304 bytes

This function compiles to 2628 bytes, 2 callsites

text data bss dec hex filename

  15197	     16	      0	  15213	   3b6d	direct-io.o.before1
   9655	     16	      0	   9671	   25c7	direct-io.o
---
 fs/direct-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/direct-io.c +1 -1
index d6a9012..21ec685 100644
@@ -774,7 +774,7 @@ out:
  * If that doesn't work out then we put the old page into the bio and add this
  * page to the dio instead.
  */
-static inline int
+static int
 submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
 		    unsigned offset, unsigned len, sector_t blocknr,
 		    struct buffer_head *map_bh)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/1 direct-io: Deinline dio_zero_block, save 2684 bytes

This function compiles to 2684 bytes, 2 callsites

text data bss dec hex filename

   9655	     16	      0	   9671	   25c7	direct-io.o.before2
   9559	     16	      0	   9575	   2567	direct-io.o
---
 fs/direct-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/direct-io.c +1 -1
index 21ec685..729c902 100644
@@ -857,7 +857,7 @@ static void clean_blockdev_aliases(struct dio *dio, struct buffer_head *map_bh)
  * `end' is zero if we're doing the start of the IO, 1 at the end of the
  * IO.
  */
-static inline void dio_zero_block(struct dio *dio, struct dio_submit *sdio,
+static void dio_zero_block(struct dio *dio, struct dio_submit *sdio,
 		int end, struct buffer_head *map_bh)
 {
 	unsigned dio_blocks_per_fs_block;
Signature · 1 line
1.8.1.4
#2 lore raw

Re: [PATCH] direct-io: Deinline dio_zero_block, save 2684 bytes

Quoted 5 lines · Denys Vlasenko

This function compiles to 2684 bytes, 2 callsites

   text	   data	    bss	    dec	    hex	filename
   9655	     16	      0	   9671	   25c7	direct-io.o.before2
   9559	     16	      0	   9575	   2567	direct-io.o

NAK

#3 lore raw

PATCH 1/1 direct-io: Deinline dio_send_cur_page, save ~2000 bytes

In reply to Denys Vlasenko

This function compiles to 1070 bytes, 2 callsites

text data bss dec hex filename

   9559	     16	      0	   9575	   2567	direct-io.o.before3
   7587	     16	      0	   7603	   1db3	direct-io.o
---
 fs/direct-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/direct-io.c +1 -1
index 729c902..469baf7 100644
@@ -710,7 +710,7 @@ static inline int dio_bio_add_page(struct dio_submit *sdio)
  * The caller of this function is responsible for removing cur_page from the
  * dio, and for dropping the refcount which came from that presence.
  */
-static inline int dio_send_cur_page(struct dio *dio, struct dio_submit *sdio,
+static int dio_send_cur_page(struct dio *dio, struct dio_submit *sdio,
 		struct buffer_head *map_bh)
 {
 	int ret = 0;
Signature · 1 line
1.8.1.4
#4 lore raw

Re: [PATCH] direct-io: Deinline dio_send_cur_page, save ~2000 bytes

Quoted 5 lines · Denys Vlasenko

This function compiles to 1070 bytes, 2 callsites

   text	   data	    bss	    dec	    hex	filename
   9559	     16	      0	   9575	   2567	direct-io.o.before3
   7587	     16	      0	   7603	   1db3	direct-io.o

NAK

#5 lore raw
In reply to Denys Vlasenko
Quoted 5 lines · Denys Vlasenko

This function compiles to 2628 bytes, 2 callsites

text data bss dec hex filename

  15197	     16	      0	  15213	   3b6d	direct-io.o.before1
   9655	     16	      0	   9671	   25c7	direct-io.o

And what is the consequence for performance? If you look at the git history for this file, you'll find the commit that introduced the inline:

commit ba253fbf6d3502c54e1ac8792e7ac8290a1f5b8d

Author: Andi Kleen <[email protected]>
Date:   Mon Aug 1 21:38:08 2011 -0700

direct-io: inline the complete submission path

Add inlines to all the submission path functions. While this increases code size it also gives gcc a lot of optimization opportunities in this critical hotpath.

...

So you're essentially undoing that work.

NAK

Cheers,
Jeff