mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fawad Lateef <fawadlateef@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: Unusually long delay in the kernel
Date: Fri, 16 Sep 2005 22:58:36 +0500	[thread overview]
Message-ID: <1e62d137050916105843147c93@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0509161236440.4523-100000@iolanthe.rowland.org>

On 9/16/05, Alan Stern <stern@rowland.harvard.edu> wrote:
> This code excerpt is taken from the start of the control thread for the
> usb-storage driver in 2.6.14-rc1:
> 
> 
> static int usb_stor_control_thread(void * __us)
> {
>         struct us_data *us = (struct us_data *)__us;
>         struct Scsi_Host *host = us_to_host(us);
> 
> printk(KERN_INFO "Before thread start\n");
>         lock_kernel();
> 
>         /*
>          * This thread doesn't need any user-level access,
>          * so get rid of all our resources.
>          */
>         daemonize("usb-storage");
>         current->flags |= PF_NOFREEZE;
>         unlock_kernel();
> printk(KERN_INFO "After thread start\n");
> 
> 
> The code between the two printk's takes a long time to run.  I don't have
> precise numbers, but it feels like more than 1 second.
> 
> (1) Can anyone explain why, or indicate how to speed it up?
> 
> (2) Are the {un}lock_kernel calls really needed?
> 

AFAIR the article on the lwn.net in the driver porting porting to 2.6
kernel mentioned that big kernel locks lock_kernel and unlock_kernel
gone, but as I searched into the kernel's drivers directory for the
kernel_thread functions (drivers creating threads), I found some of
them using lock_kernel and some not .... So I also wants to know are
they really needed ??

By the way I havn't saw/felt any long delay when starting thread in
this way using lock_kernel !!!!


-- 
Fawad Lateef

  reply	other threads:[~2005-09-16 17:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-16 16:42 Alan Stern
2005-09-16 17:58 ` Fawad Lateef [this message]
2005-09-17  6:52 ` Andrew Morton
2005-09-17 22:15   ` Alan Stern
2005-09-17 23:41     ` Andrew Morton
2005-09-18 15:05       ` Alan Stern
2005-09-18 20:09         ` Andrew Morton
2005-09-19 14:40           ` [Proposed PATCH] Add kthread_stop_sem Alan Stern
2005-09-19 18:06       ` Unusually long delay in the kernel Alan Stern

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=1e62d137050916105843147c93@mail.gmail.com \
    --to=fawadlateef@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®