public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: George Anzinger <george@mvista.com>
Cc: Roman Zippel <zippel@linux-m68k.org>,
	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: [UPDATE PATCH] push rounding up of relative request to schedule_timeout()
Date: Tue, 16 Aug 2005 22:56:22 -0700	[thread overview]
Message-ID: <20050817055622.GB4143@us.ibm.com> (raw)
In-Reply-To: <4302872F.2050303@mvista.com>

On 16.08.2005 [17:39:11 -0700], George Anzinger wrote:
> Nishanth Aravamudan wrote:
> >On 04.08.2005 [09:45:55 -0700], George Anzinger wrote:
> >
> >>Uh... PLEASE tell me you are NOT changing timespec_to_jiffies() (and 
> >>timeval_to_jiffies() to add 1.  This is NOT the right thing to do.  For 
> >>repeating times (see setitimer code) we need the actual time as we KNOW 
> >>where the jiffies edge is in the repeating case.  The +1 is needed ONLY 
> >>for the initial time, not the repeating time.
> >>
> >>
> >>See:
> >>http://marc.theaimsgroup.com/?l=linux-kernel&m=112208357906156&w=2
> >
> >
> >I followed that thread, George, but I think it's a different case with
> >schedule_timeout() [maybe this indicates drivers/other users should
> >maybe be using itimers, but I'll get to that in a sec].
> 
> I think I miss understood back then :).

Ok, no problem. I was just thinking today about all the issues that were
borught up... I really appreciate your feedback.

> >
> >With schedule_timeout(), we are just given a relative jiffies value. We
> >have no context as to which task is requesting the delay, per se,
> >meaning we don't (can't) know from the interface whether this is the
> >first delay in a sequence, or a brand new one, without changing all
> >users to have some sort of control structure. The callers of
> >schedule_timeout() don't even get a pointer to the timer added
> >internally.
> >
> >So, adding 1 to all sleeps seems like it might be reasonable, as looping
> >sleeps probably need to use a different interface. I had worked a bit
> >ago on something like poll_event() with the kernel-janitors group, which
> >would abstract out the repeated sleeps. Basically wait_event() without
> >wait-queues... Maybe we could make such an interface just use itimers?
> >I've attached my old patch for poll_event(), just for reference.
> 
> I think not.  itimers is really pointed at a particular system call and 
> has resources in the task structure to do it.  These would be hard to 
> share...

Ok, I wasn't sure about that -- I'm not too familiar with the itimer
code (maybe I'll take a look at it soon :) )

> >My point, I guess, is that in the schedule_timeout() case, we don't know
> >where the jiffies edge is, as we either expire or receive a wait-queue
> >event/signal, we never mod_timer() the internal timer... So we have to
> >assume that we need to sleep the request. But maybe Roman's idea of
> >sleeping a certain number of jiffy edges is sufficient. I am not yet
> >convinced driver authors want/need such an interface, though, still
> >thinking it over.
> 
> IMNSHO we should not get too parental with kernel only interfaces. 
> Adding 1 is easy enough for the caller and even easier to explain in the 
> instructions (i.e. this call sleeps for X jiffies edges).  This allows 
> the caller to do more if needed and, should he ever just want to sync to 
> the next jiffie he does not have to deal with backing out that +1.

I don't want to be too parental either, but I also am trying to avoid
code duplication. Lots of drivers basically do something like
poll_event() does (or could do with some changes), i.e. looping a
constant amount multiple times, checking something every so often. The
patch was just a thought, though. I will keep evaluating drivers and see
if it's a useful interface to have eventually.

I guess I'm just concerned with making an unintuitive interface. As was
brought up at OLS, drivers are a major source of bugs/buggy code. The
simpler, more useful we can make interfaces, the better, I think. I'm
not claiming you disagree, I just want to make my own motives clear.
While fixing up the schedule_timeout() comment would make it clear what
schedule_timeout() achieves, I'm not sure how useful such an interface
is, if every caller adds 1 :) I need to mull it over, though... Lots to
consider. I also, of course, want to stay flexible for the reasons you
mention (letting the driver adjust the timeout as they expect to).

Thanks,
Nish

  reply	other threads:[~2005-08-17  5:56 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 [this message]
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
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=20050817055622.GB4143@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=george@mvista.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox