Skip to content

Commit ebf3f09

Browse files
tpetazzonitorvalds
authored andcommitted
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 <mpm@selenic.com>, and is part of the Linux Tiny project. [randy.dunlap@oracle.com: build fix] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Benjamin LaHaise <bcrl@kvack.org> Cc: Zach Brown <zach.brown@oracle.com> Signed-off-by: Matt Mackall <mpm@selenic.com> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent d827367 commit ebf3f09

5 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎fs/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
obj-y := open.o read_write.o file_table.o super.o \
99
char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
1010
ioctl.o readdir.o select.o fifo.o dcache.o inode.o \
11-
attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \
11+
attr.o bad_inode.o file.o filesystems.o namespace.o \
1212
seq_file.o xattr.o libfs.o fs-writeback.o \
1313
pnode.o drop_caches.o splice.o sync.o utimes.o \
1414
stack.o
@@ -27,6 +27,7 @@ obj-$(CONFIG_ANON_INODES) += anon_inodes.o
2727
obj-$(CONFIG_SIGNALFD) += signalfd.o
2828
obj-$(CONFIG_TIMERFD) += timerfd.o
2929
obj-$(CONFIG_EVENTFD) += eventfd.o
30+
obj-$(CONFIG_AIO) += aio.o
3031
obj-$(CONFIG_FILE_LOCKING) += locks.o
3132
obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o
3233

‎include/linux/aio.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,21 @@ struct kioctx {
204204
/* prototypes */
205205
extern unsigned aio_max_size;
206206

207+
#ifdef CONFIG_AIO
207208
extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
208209
extern int aio_put_req(struct kiocb *iocb);
209210
extern void kick_iocb(struct kiocb *iocb);
210211
extern int aio_complete(struct kiocb *iocb, long res, long res2);
211212
struct mm_struct;
212213
extern void exit_aio(struct mm_struct *mm);
214+
#else
215+
static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
216+
static inline int aio_put_req(struct kiocb *iocb) { return 0; }
217+
static inline void kick_iocb(struct kiocb *iocb) { }
218+
static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; }
219+
struct mm_struct;
220+
static inline void exit_aio(struct mm_struct *mm) { }
221+
#endif /* CONFIG_AIO */
213222

214223
#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
215224

‎init/Kconfig‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,14 @@ config SHMEM
713713
option replaces shmem and tmpfs with the much simpler ramfs code,
714714
which may be appropriate on small systems without swap.
715715

716+
config AIO
717+
bool "Enable AIO support" if EMBEDDED
718+
default y
719+
help
720+
This option enables POSIX asynchronous I/O which may by used
721+
by some high performance threaded applications. Disabling
722+
this option saves about 7k.
723+
716724
config VM_EVENT_COUNTERS
717725
default y
718726
bool "Enable VM event counters for /proc/vmstat" if EMBEDDED

‎kernel/sys_ni.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ cond_syscall(sys_vm86);
126126
cond_syscall(compat_sys_ipc);
127127
cond_syscall(compat_sys_sysctl);
128128
cond_syscall(sys_flock);
129+
cond_syscall(sys_io_setup);
130+
cond_syscall(sys_io_destroy);
131+
cond_syscall(sys_io_submit);
132+
cond_syscall(sys_io_cancel);
133+
cond_syscall(sys_io_getevents);
129134

130135
/* arch-specific weak syscall entries */
131136
cond_syscall(sys_pciconfig_read);

‎kernel/sysctl.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ static struct ctl_table fs_table[] = {
12811281
.extra2 = &two,
12821282
},
12831283
#endif
1284+
#ifdef CONFIG_AIO
12841285
{
12851286
.procname = "aio-nr",
12861287
.data = &aio_nr,
@@ -1295,6 +1296,7 @@ static struct ctl_table fs_table[] = {
12951296
.mode = 0644,
12961297
.proc_handler = &proc_doulongvec_minmax,
12971298
},
1299+
#endif /* CONFIG_AIO */
12981300
#ifdef CONFIG_INOTIFY_USER
12991301
{
13001302
.ctl_name = FS_INOTIFY,

0 commit comments

Comments
 (0)