kern/156567: Add EV_CLEAR to AIO events in kqueue
Igor Soumenkov
igor at soumenkov.com
Fri Apr 22 10:20:02 UTC 2011
>Number: 156567
>Category: kern
>Synopsis: Add EV_CLEAR to AIO events in kqueue
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Apr 22 10:20:01 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Igor Soumenkov
>Release: 8.2-STABLE
>Organization:
>Environment:
FreeBSD igosha2 8.2-STABLE FreeBSD 8.2-STABLE #6: Fri Apr 22 13:53:04 MSD 2011 root at igosha2:/usr/obj/usr/src/sys/IGOSHA-WORK-8 amd64
>Description:
Current implementation of AIO does not set the EV_CLEAR flag when adding new AIO events in the kqueue. This causes problems while fetching kevents from several threads. I can't imagine the situation when the AIO event should be read many times, so I suggest adding EV_CLEAR to all AIO events.
>How-To-Repeat:
Schedule aio operation, i.e. aio_read or aio_write with kqueue notification. If you use kevent in several threads, several copies of the EVFILT_AIO events will be fetched.
>Fix:
I suggest adding EV_CLEAR to the flags of the AIO event, since there is no way to control it with aio_ operations directly.
If it is not acceptable maybe there should be a sysctl or other tunable option.
Patch attached with submission follows:
--- sys/kern/vfs_aio.c.old 2011-04-22 13:49:37.000000000 +0400
+++ sys/kern/vfs_aio.c 2011-04-22 13:49:45.000000000 +0400
@@ -1622,7 +1622,7 @@
kqfd = aiocbe->uaiocb.aio_sigevent.sigev_notify_kqueue;
kev.ident = (uintptr_t)aiocbe->uuaiocb;
kev.filter = EVFILT_AIO;
- kev.flags = EV_ADD | EV_ENABLE | EV_FLAG1;
+ kev.flags = EV_ADD | EV_ENABLE | EV_CLEAR | EV_FLAG1;
kev.data = (intptr_t)aiocbe;
kev.udata = aiocbe->uaiocb.aio_sigevent.sigev_value.sival_ptr;
error = kqfd_register(kqfd, &kev, td, 1);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list