All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Arjan van de Ven <arjan@infradead.org>,
	Andrew Morton <akpm@osdl.org>,
	domen@coderock.org, linux-kernel@vger.kernel.org,
	clucas@rotomalug.org
Subject: Re: [PATCH] Add schedule_timeout_{interruptible,uninterruptible}{,_msecs}() interfaces
Date: Sat, 23 Jul 2005 12:06:26 -0700	[thread overview]
Message-ID: <20050723190626.GA4345@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0507231854180.3728@scrub.home>

On 23.07.2005 [19:01:57 +0200], Roman Zippel wrote:
> Hi,
> 
> On Sat, 23 Jul 2005, Nishanth Aravamudan wrote:
> 
> > 	set_current_state(TASK_{,UN}INTERRUPTIBLE);
> > 	schedule_timeout(msecs_to_jiffies(some_constant_msecs));
> > 
> > just have an interface that allows
> > 
> > 	schedule_timeout_msecs_{,un}interruptible(some_constant_msecs);
> > 
> > and push the jiffies conversion to common code?
> 
> What's wrong with just:
> 
> 	schedule_timeout_{,un}interruptible(msecs_to_jiffies(some_constant_msecs));

Nothing, I suppose. I just prefer directly using msecs. I understand
your point more now, I think. You are worried about those people that
actually use the return value of schedule_timeout().

> The majority of users use a constant, which can already be converted at 
> compile tile.
> Additionally such an interface also had to return a ms value and instead 
> of that constant conversion, the user is better off to work with jiffies 
> directly.

So, I just spent a good hour looking at every caller of
schedule_timeout() which actually stores the return value. Beyond the
other wrappers for it (wait_event(), wait_for_completion(),
sys_nanosleep(), etc., which I will leave alone using schedule_timeout()
until I can change *their* parameters ;) ), I found two cases.

1) Sleep, see if you actually slept the whole time:

	remainder = schedule_timeout(some_value_in_jiffies);
	if (!remaining)
		report_timeout();

2) Sleep in a loop, keeping track of remaining timeout each iteration:

	while (timeout) {
		do_some_stuff();
		timeout = schedule_timeout(timeout);
		if (some_condition)
			break;
	}

Clearly, neither needs to use jiffies. The former only wants to know if
the full timeout elapsed. I didn't find anyone returning that stored
value (again, excepting wrapper interfaces) to the caller. They just
want to know if they should return -ETIME{,DOUT}. The latter just is a
means to guarantee the entire time is slept, but doesn't care about the
units.

Now, some of these might depend on structures which have members with
jiffy-unit values. But I will be more than happy to try and either leave
them alone or convert those structures. We'll see about that on a
case-by-case basis?

Thanks,
Nish

  reply	other threads:[~2005-07-23 19:12 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-07 21:31 [patch 1/4] drivers/char/ip2/i2lib.c: replace direct assignment with set_current_state() domen
2005-07-08 23:08 ` Andrew Morton
2005-07-08 23:22   ` Nish Aravamudan
2005-07-23  0:27   ` [PATCH] Add schedule_timeout_{interruptible,uninterruptible}{,_msecs}() interfaces Nishanth Aravamudan
2005-07-23  0:31     ` Arjan van de Ven
2005-07-23  1:08       ` [UPDATE PATCH] Add schedule_timeout_{interruptible,uninterruptible}_msecs() interfaces Nishanth Aravamudan
2005-07-23  2:30         ` Andrew Morton
2005-07-23 16:23           ` Nishanth Aravamudan
2005-07-23 10:50       ` [PATCH] Add schedule_timeout_{interruptible,uninterruptible}{,_msecs}() interfaces Roman Zippel
2005-07-23 11:09         ` Arjan van de Ven
2005-07-23 11:55           ` Roman Zippel
2005-07-23 12:51             ` Arjan van de Ven
2005-07-23 13:04               ` Roman Zippel
2005-07-23 13:12                 ` Arjan van de Ven
2005-07-23 13:29                   ` Roman Zippel
2005-07-23 13:32                     ` Arjan van de Ven
2005-07-23 15:56                       ` Roman Zippel
2005-07-23 16:44                     ` Nishanth Aravamudan
2005-07-23 16:43                 ` Nishanth Aravamudan
2005-07-23 17:17                   ` Roman Zippel
2005-07-23 19:10                     ` Nishanth Aravamudan
2005-07-23 20:12                       ` Roman Zippel
2005-07-27 22:29                         ` Nishanth Aravamudan
2005-07-30 23:35                           ` Roman Zippel
2005-08-01 19:35                             ` [UPDATE PATCH] Add schedule_timeout_{intr,unintr}{,_msecs}() interfaces Nishanth Aravamudan
2005-08-03 14:20                               ` Roman Zippel
2005-08-04  0:51                                 ` [PATCH] push rounding up of relative request to schedule_timeout() Nishanth Aravamudan
2005-08-04  5:14                                   ` [UPDATE PATCH] " Nishanth Aravamudan
2005-08-04 16:45                                     ` George Anzinger
2005-08-04 18:48                                       ` Nish Aravamudan
2005-08-16 23:05                                       ` Nishanth Aravamudan
2005-08-17  0:39                                         ` George Anzinger
2005-08-17  5:56                                           ` Nishanth Aravamudan
2005-08-17 19:51                                             ` George Anzinger
2005-08-17 22:24                                               ` Nishanth Aravamudan
2005-08-04 17:05                                     ` George Anzinger
2005-08-04 18:49                                       ` Nish Aravamudan
2005-08-04  9:38                                   ` [PATCH] " Roman Zippel
2005-08-04 14:33                                     ` Nishanth Aravamudan
2005-08-04 18:59                                       ` Roman Zippel
2005-08-04 19:11                                         ` Nishanth Aravamudan
2005-08-04 23:20                                           ` Roman Zippel
2005-08-04 17:08                                     ` Andrew Morton
2005-08-04 19:00                                       ` [PATCH] add schedule_timeout_{,un}intr() interfaces Nishanth Aravamudan
2005-08-05  7:38                                         ` Andrew Morton
2005-07-23 16:37             ` [PATCH] Add schedule_timeout_{interruptible,uninterruptible}{,_msecs}() interfaces Nishanth Aravamudan
2005-07-23 17:01               ` Roman Zippel
2005-07-23 19:06                 ` Nishanth Aravamudan [this message]
2005-07-23 20:22                   ` Roman Zippel
2005-07-23 16:30         ` Nishanth Aravamudan

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=20050723190626.GA4345@us.ibm.com \
    --to=nacc@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=clucas@rotomalug.org \
    --cc=domen@coderock.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.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.