vcs: hook sysfs devices into object lifetime instead of "binding"

Previous thread: driver core: fix passing platform_data by Linux Kernel Mailing List on Thursday, March 26, 2009 - 12:27 pm. (1 message)

Next thread: Driver core: implement uevent suppress in kobject by Linux Kernel Mailing List on Thursday, March 26, 2009 - 12:27 pm. (1 message)
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:27 pm

Gitweb:     http://git.kernel.org/linus/4995f8ef9d3aac72745e12419d7fbaa8d01b1d81
Commit:     4995f8ef9d3aac72745e12419d7fbaa8d01b1d81
Parent:     ce21c7bcd796fc4f45d48781b7e85f493cc55ee5
Author:     Kay Sievers <kay.sievers@vrfy.org>
AuthorDate: Mon Mar 9 14:18:52 2009 +0100
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Tue Mar 24 16:38:26 2009 -0700

    vcs: hook sysfs devices into object lifetime instead of "binding"
    
    During bootup performance tracing I noticed many occurrences of
    vca* device creation and removal, leading to the usual userspace
    uevent processing, which are, in this case, rather pointless.
    
    A simple test showing the kernel timing (not including all the
    work userspace has to do), gives us these numbers:
      $ time for i in `seq 1000`; do echo a > /dev/tty2; done
      real    0m1.142s
      user    0m0.015s
      sys     0m0.540s
    
    If we move the hook for the vcs* driver core devices from the
    tty "binding" to the vc allocation/deallocation, which is what
    the vcs* devices represent, we get the following numbers:
      $ time for i in `seq 1000`; do echo a > /dev/tty2; done
      real    0m0.152s
      user    0m0.030s
      sys     0m0.072s
    
    Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
    Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/char/vc_screen.c |   16 ++++++++--------
 drivers/char/vt.c        |    5 +++--
 include/linux/console.h  |    4 ++--
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
index 4f3b3f9..d94d25c 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -479,18 +479,18 @@ static const struct file_operations vcs_fops = {
 
 static struct class *vc_class;
 
-void vcs_make_sysfs(struct tty_struct *tty)
+void vcs_make_sysfs(int index)
 {
-	device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), ...
Previous thread: driver core: fix passing platform_data by Linux Kernel Mailing List on Thursday, March 26, 2009 - 12:27 pm. (1 message)

Next thread: Driver core: implement uevent suppress in kobject by Linux Kernel Mailing List on Thursday, March 26, 2009 - 12:27 pm. (1 message)