public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: linux-kernel@vger.kernel.org
Subject: About I/O callbacks ...
Date: Thu, 21 Jun 2001 18:46:45 -0700 (PDT)	[thread overview]
Message-ID: <XFMail.20010621184645.davidel@xmailserver.org> (raw)


I was just thinking to implement I/O callbacks inside the kernel and test which
kind of performance could result compared to a select()/poll() implementation.
I prefer IO callbacks against async-io coz in this way is more direct to
implement an I/O driven state machine + coroutines.
This is a first draft :



#define ASCB_INFO_NPARAMS 4

struct ascb_info {
        unsigned long param[ASCB_INFO_NPARAMS];
};

struct iocb {
        struct iocb * next;
        struct task_struct * task;
        unsigned long event;
        int (*iocb_func)(struct ascb_info *, void *);
        void * data;
};

struct ascb {
        struct ascb * next;
        int (*ascb_func)(struct ascb_info *, void *);
        void * data;
        struct ascb_info info;
};





struct task_struct {
        ...
        struct ascb * ascb_list;
        spinlock_t ascb_list_lock;
        ...
};


struct file {
        ...
        struct iocb * iocb_list;
        spinlock_t iocb_list_lock;
        ...
};




The user call some user-space api to add the callback to the fd and this will
result ( inside the kernel ) to a call to :



int iocb_file_add(struct file * file,
                int (*iocb_func)(struct ascb_info *, void *), void * data,
                unsigned long event) {

/*
 *  Add the callback to the file list with task = current
 */


}



This is used to add callbacks to the task's list :

int ascb_task_add(struct task_struct * task,
                int (*ascb_func)(struct ascb_info *, void *),
                void * data, struct ascb_info * info) {

/*
 *  Add the callback to the task list
 */

}




Low level I/O layers will call this to dispatch I/O events :


int iocb_file_dispatch(struct file * file, unsigned long event) {

/*
 *  Scan the iocb_list and ( if event match ) call ascb_task_add()
 *  and remove ( y/n ? ) the callback from iocb_list
 */


}




In entry.S we'll have a call like do_signal() that will build the frame for a
callback call ( like do_signal() ) and will remove the entry from the list.
My first implementation should address only sockets but once the concept of
async callbacks is inside the task_struct this could be gradually extended to
std files and even used as an extension of signals.

Comments ?





- Davide



             reply	other threads:[~2001-06-22  1:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-22  1:46 Davide Libenzi [this message]
     [not found] <XFMail.20010621184645.davidel@xmailserver.org.suse.lists.linux.kernel>
2001-06-22  7:49 ` About I/O callbacks Andi Kleen
2001-06-22 15:55   ` Davide Libenzi
2001-06-22 15:59     ` Andi Kleen
2001-06-22 16:07       ` Davide Libenzi
2001-06-22 22:23       ` Davide Libenzi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=XFMail.20010621184645.davidel@xmailserver.org \
    --to=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox