Skip to contentSkip to conversation

Configure out AIO support

PATCH Superseded Thomas Petazzoni 6 participants 8 messages Jul 29, 2008 – Jul 31, 2008 3 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/4 Configure out AIO support

This patchs adds the CONFIG_AIO option which allows to remove support for asynchronous I/O operations, that are not necessarly used by applications, particularly on embedded devices. As this is a size-reduction option, it depends on CONFIG_EMBEDDED. It allows to save ~7 kilobytes of kernel code/data:

text data bss dec hex filename
1115067 119180 217088 1451335 162547 vmlinux
1108025 119048 217088 1444161 160941 vmlinux.new
-7042 -132 0 -7174 -1C06 +/-

This patch has been originally written by Matt Mackall <[email protected]>, and is part of the Linux Tiny project.

---
 fs/Makefile         |    3 ++-
 include/linux/aio.h |    9 +++++++++
 init/Kconfig        |    8 ++++++++
 kernel/sys_ni.c     |    5 +++++
 kernel/sysctl.c     |    2 ++
 5 files changed, 26 insertions(+), 1 deletion(-)
fs/Makefile +2 -1
Index: linuxdev/fs/Makefile
===================================================================
@@ -8,7 +8,7 @@
 obj-y :=	open.o read_write.o file_table.o super.o \
 		char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
 		ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \
-		attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \
+		attr.o bad_inode.o file.o filesystems.o namespace.o \
 		seq_file.o xattr.o libfs.o fs-writeback.o \
 		pnode.o drop_caches.o splice.o sync.o utimes.o \
 		stack.o
@@ -27,6 +27,7 @@
 obj-$(CONFIG_SIGNALFD)		+= signalfd.o
 obj-$(CONFIG_TIMERFD)		+= timerfd.o
 obj-$(CONFIG_EVENTFD)		+= eventfd.o
+obj-$(CONFIG_AIO)               += aio.o
 obj-$(CONFIG_COMPAT)		+= compat.o compat_ioctl.o
 
 nfsd-$(CONFIG_NFSD)		:= nfsctl.o
include/linux/aio.h +9 -0
Index: linuxdev/include/linux/aio.h
===================================================================
@@ -204,12 +204,21 @@
 /* prototypes */
 extern unsigned aio_max_size;
 
+#ifdef CONFIG_AIO
 extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
 extern int aio_put_req(struct kiocb *iocb);
 extern void kick_iocb(struct kiocb *iocb);
 extern int aio_complete(struct kiocb *iocb, long res, long res2);
 struct mm_struct;
 extern void exit_aio(struct mm_struct *mm);
+#else
+static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
+static inline int aio_put_req(struct kiocb *iocb) { return 0; }
+static inline void kick_iocb(struct kiocb *iocb) { }
+static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; }
+struct mm_struct;
+static inline void exit_aio(struct mm_struct *mm) { }
+#endif /* CONFIG_AIO */
 
 #define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
 
init/Kconfig +8 -0
Index: linuxdev/init/Kconfig
===================================================================
@@ -724,6 +724,14 @@
 	  option replaces shmem and tmpfs with the much simpler ramfs code,
 	  which may be appropriate on small systems without swap.
 
+config AIO
+	bool "Enable AIO support" if EMBEDDED
+	default y
+	help
+	  This option enables POSIX asynchronous I/O which may by used
+          by some high performance threaded applications. Disabling
+          this option saves about 7k.
+
 config VM_EVENT_COUNTERS
 	default y
 	bool "Enable VM event counters for /proc/vmstat" if EMBEDDED
kernel/sys_ni.c +5 -0
Index: linuxdev/kernel/sys_ni.c
===================================================================
@@ -125,6 +125,11 @@
 cond_syscall(sys_vm86);
 cond_syscall(compat_sys_ipc);
 cond_syscall(compat_sys_sysctl);
+cond_syscall(sys_io_setup);
+cond_syscall(sys_io_destroy);
+cond_syscall(sys_io_submit);
+cond_syscall(sys_io_cancel);
+cond_syscall(sys_io_getevents);
 
 /* arch-specific weak syscall entries */
 cond_syscall(sys_pciconfig_read);
kernel/sysctl.c +2 -0
Index: linuxdev/kernel/sysctl.c
===================================================================
@@ -1290,6 +1290,7 @@
 		.extra1		= &zero,
 		.extra2		= &two,
 	},
+#ifdef CONFIG_AIO
 	{
 		.procname	= "aio-nr",
 		.data		= &aio_nr,
@@ -1304,6 +1305,7 @@
 		.mode		= 0644,
 		.proc_handler	= &proc_doulongvec_minmax,
 	},
+#endif /* CONFIG_AIO */
 #ifdef CONFIG_INOTIFY_USER
 	{
 		.ctl_name	= FS_INOTIFY,
Signature · 10 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to [email protected].  For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"[email protected]">[email protected]</a>

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 12 lines · Thomas Petazzoni

plain text document attachment (configure-out-aio-support) This patchs adds the CONFIG_AIO option which allows to remove support for asynchronous I/O operations, that are not necessarly used by applications, particularly on embedded devices. As this is a size-reduction option, it depends on CONFIG_EMBEDDED. It allows to save ~7 kilobytes of kernel code/data:

text data bss dec hex filename
1115067 119180 217088 1451335 162547 vmlinux
1108025 119048 217088 1444161 160941 vmlinux.new
-7042 -132 0 -7174 -1C06 +/-

Quoted 8 lines

This patch has been originally written by Matt Mackall <[email protected]>, and is part of the Linux Tiny project.

These all look good to me, naturally.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [patch 2/4] Configure out file locking features

Quoted 11 lines · Thomas Petazzoni

This patch adds the CONFIG_FILE_LOCKING option which allows to remove support for advisory locks. With this patch enabled, the flock() system call, the F_GETLK, F_SETLK and F_SETLKW operations of fcntl() and NFS support are disabled. These features are not necessarly needed on embedded systems. It allows to save ~11 Kb of kernel code and data:

text data bss dec hex filename
1125436 118764 212992 1457192 163c28 vmlinux.old
1114299 118564 212992 1445855 160fdf vmlinux
-11137 -200 0 -11337 -2C49 +/-

Quoted 4 lines

This patch has originally been written by Matt Mackall <[email protected]>, and is part of the Linux Tiny project.

In principle, I think this is a great idea.

Review

Quoted 7 lines

config NFS_FS

(quoted diff) +1 -1
 	tristate "NFS client support"
-	depends on INET
+	depends on INET && FILE_LOCKING
 	select LOCKD
 	select SUNRPC
 	select NFS_ACL_SUPPORT if NFS_V3_ACL

I think this part is a little lazy. It should be possible to support NFS without file locking. I suspect that's really not in-scope for the linux-tiny tree as currently envisaged with the focus on embedded devices that probably don't use NFS anyway. Do we want to care about the situation of a machine with fixed workload, that doesn't need file locking, but does use NFS?

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#6 lore raw

Re: [patch 2/4] Configure out file locking features

Quoted 19 lines · Matthew Wilcox
Quoted 11 lines · Thomas Petazzoni

This patch adds the CONFIG_FILE_LOCKING option which allows to remove support for advisory locks. With this patch enabled, the flock() system call, the F_GETLK, F_SETLK and F_SETLKW operations of fcntl() and NFS support are disabled. These features are not necessarly needed on embedded systems. It allows to save ~11 Kb of kernel code and data:

text data bss dec hex filename
1125436 118764 212992 1457192 163c28 vmlinux.old
1114299 118564 212992 1445855 160fdf vmlinux
-11137 -200 0 -11337 -2C49 +/-

Quoted 4 lines

This patch has originally been written by Matt Mackall <[email protected]>, and is part of the Linux Tiny project.

In principle, I think this is a great idea.

Quoted 14 lines

Review

Quoted 7 lines

config NFS_FS

(quoted diff) +1 -1
 	tristate "NFS client support"
-	depends on INET
+	depends on INET && FILE_LOCKING
 	select LOCKD
 	select SUNRPC
 	select NFS_ACL_SUPPORT if NFS_V3_ACL

I think this part is a little lazy. It should be possible to support NFS without file locking. I suspect that's really not in-scope for the linux-tiny tree as currently envisaged with the focus on embedded devices that probably don't use NFS anyway. Do we want to care about the situation of a machine with fixed workload, that doesn't need file locking, but does use NFS?

I would lean towards no, but if someone comes along who cares, they're welcome to try it. This stuff all has to strike a balance between savings and effort/complexity/maintainability, so any time the submitter is too lazy to cover a less common use case, it's probably a good sign they're approaching that tipping point.

On the other hand, if you think it's trivial to do a locking-ectomy on NFS, I'd be happy to see it.

The typical embedded NFS-based devices are NAS servers and media players and are going to be more concerned about things like page cache balancing.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#7 lore raw

Re: [patch 2/4] Configure out file locking features

Quoted 3 lines · Matt Mackall

The typical embedded NFS-based devices are NAS servers and media players and are going to be more concerned about things like page cache balancing.

Oh, those.

It would be really annoying to buy a home NAS and find it doesn't support NFS locks or SMB oplocks. NASes are vaguely useful for more than one computer in the house at the same time.

That said, I bought a big, expensive one, found it far too slow for my needs, send it back for a refund and bought a portable cheap USB disk which had *so* much higher performance. The convenience of serving multiple machines just wasn't worth the lousy performance.

-- Jamie

#8 lore raw

Re: [patch 2/4] Configure out file locking features

In reply to Matthew Wilcox

It seems the emails containing the patches never made it to the vger lists, which makes it a bit hard to comment on them.

Thomas, can you try to figure out what went wrong and resend them then?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#9 lore raw

Re: [patch 2/4] Configure out file locking features

Quoted 2 lines · Adrian Bunk

It seems the emails containing the patches never made it to the vger lists, which makes it a bit hard to comment on them.

Yes, they didn't make it to the lists, for some reason. Maybe it's because I sent them using "quilt mail --send", which uses my local exim4 mail server, and for some reason, vger doesn't like that kind of e-mails. However, my exim4 is configured to sent the e-mails through by ISP SMTP. From my exim4 mainlog:

2008-07-29 17:47:57 1KNrQS-0007kt-Kg => [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg Completed

So from my side, everything seemed to work well. Does anybody has a clue ?

Quoted 2 lines

Thomas, can you try to figure out what went wrong and resend them then?

I will send them again through my normal MUA, using quilt mail --mbox. Hopefully it'll work.

Sincerly,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
#10 lore raw

Re: [patch 2/4] Configure out file locking features

Hello Thomas,

Quoted 22 lines · Thomas Petazzoni
Quoted 2 lines · Adrian Bunk

It seems the emails containing the patches never made it to the vger lists, which makes it a bit hard to comment on them.

Yes, they didn't make it to the lists, for some reason. Maybe it's because I sent them using "quilt mail --send", which uses my local exim4 mail server, and for some reason, vger doesn't like that kind of e-mails. However, my exim4 is configured to sent the e-mails through by ISP SMTP. From my exim4 mainlog:

2008-07-29 17:47:57 1KNrQS-0007kt-Kg => [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg -> [email protected] R=smarthost T=remote_smtp_smarthost H=smtp.free.fr [212.27.48.4]*
2008-07-29 17:47:57 1KNrQS-0007kt-Kg Completed
Quoted 2 lines

So from my side, everything seemed to work well. Does anybody has a clue ?

Don't know if this is the problem, but I had problems getting mails through some time ago, too. For me the problem was that the source address was [email protected].$mycompany.$tld and vger.kernel.org didn't want to take these because the host name had no DNS entry.

I fixed that by rewriting the From line in outgoing mails on my host. I'm using postfix (from Debian) so I had to add an entry to /etc/postfix/sender_canonical.

Best regards
Uwe

Signature · 7 lines
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html