All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: kernel-janitors@vger.kernel.org
Subject: [Kernel-janitors] msleep() and delay function (DVB)
Date: Thu, 01 Jul 2004 21:10:37 +0000	[thread overview]
Message-ID: <40E47DCD.1000902@us.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]

[Not subscribed to linux-dvb, so please CC back if replying from that list]

Hi,

I'm working on one of the KernelJanitor/TODO items, specifically 
converting appropriate calls to schedule_timeout() to msleep() calls 
(Addendum by Greg KH to original request by Matthew Wilcox (Calling 
yield() Considered Harmful)). In the process, I have run across the 
following code [dvb_functions.h::dvb_delay()]:

/**
  *  a sleeping delay function, waits i ms
  *
  */
static inline
void dvb_delay(int i)
{
         current->state=TASK_INTERRUPTIBLE;
         schedule_timeout((HZ*i)/1000);
}

Compare this to

/**
  * msleep - sleep safely even with waitqueue interruptions
  * @msecs: Time in milliseconds to sleep for
  */
void msleep(unsigned int msecs)
{
         unsigned long timeout = msecs_to_jiffies(msecs);

         while (timeout) {
                 set_current_state(TASK_UNINTERRUPTIBLE);
                 timeout = schedule_timeout(timeout);
         }
}

I am wondering if dvb_delay() needs to run in TASK_INTERRUPTIBLE (it's 
not the only such case I am seeing right now, but it was the first - if 
anyone would like me to send the other cases, I'd be happy to). 
Obviously, if not, then it can be replaced with msleep() calls. If it 
must, then it probably should be updated to use set_current_state() and 
msecs_to_jiffies() like msleep() does.

This is my first try at Janitor-work, so please be patient.

Thanks,
Nish

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

                 reply	other threads:[~2004-07-01 21:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=40E47DCD.1000902@us.ibm.com \
    --to=nacc@us.ibm.com \
    --cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.