public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@turbolabs.com>
To: "Luís Henriques" <lhenriques@criticalsoftware.com>
Cc: Anton Altaparmakov <aia21@cam.ac.uk>, linux-kernel@vger.kernel.org
Subject: Re: copy to suer space
Date: Tue, 20 Nov 2001 12:39:15 -0700	[thread overview]
Message-ID: <20011120123915.W1308@lynx.no> (raw)
In-Reply-To: <5.1.0.14.2.20011120165440.00a745b0@pop.cus.cam.ac.uk> <200111201714.fAKHEc276467@criticalsoftware.com> <20011120114124.T1308@lynx.no> <200111201849.fAKInr205178@criticalsoftware.com>
In-Reply-To: <200111201849.fAKInr205178@criticalsoftware.com>; from lhenriques@criticalsoftware.com on Tue, Nov 20, 2001 at 06:44:08PM +0000

On Nov 20, 2001  18:44 +0000, Luís Henriques wrote:
> > Maybe if you describe the actual problem that you are trying to solve, and
> > not the actual way you are trying to solve it, there may be a better
> > method. Usually, if something you are trying to do is very hard to do,
> > there is a different (much better) way of doing it.
> 
> I'm developping a kernel module that needs to delay a process, that is, he 
> receives a PID and, when a specific event occurs, that process shall be 
> delayed. This delay shall be done in a way that the process keeps burning CPU 
> time (it can not be, e.g., put in a waiting-list...).

Putting it into a waiting-list is by far the best solution.  This is a normal
Unix operation, like SIGSTOP, SIGCONT, and could even be done from user space.

What is the requirement that it keeps burning CPU for?  Generally, this is
what you do NOT want to do.

Depending on what that is for, you could just increment the "system time"
ticks in the process, which is kind of a hack, but not nearly so ugly as
changing the user-space code (which is truly dreadful, and I don't think
anyone on this list would ever help you do that, even if they could).

The other alternative is to make your module such that upon entry, the
user process simply busy-waits until the delay is complete.  This is also
easy to do, with something like udelay().

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/


  parent reply	other threads:[~2001-11-20 19:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.31.0111201637420.13674-100000@mail.deis.isec.pt >
2001-11-20 17:02 ` copy to suer space Anton Altaparmakov
2001-11-20 17:08   ` Luís Henriques
2001-11-20 18:41     ` Andreas Dilger
2001-11-20 18:44       ` Luís Henriques
2001-11-20 18:58         ` Hua Zhong
2001-11-20 19:39         ` Andreas Dilger [this message]
2001-11-21  0:06           ` Mike Fedyk
2001-11-21 10:52             ` Luís Henriques
2001-11-23 13:14               ` Juan Quintela
2001-11-23 14:35                 ` Luís Henriques
2001-11-23 23:53                   ` H. Peter Anvin
2001-11-20 17:37   ` Anton Altaparmakov
2001-11-20 17:53     ` Luís Henriques
2001-11-20 18:18       ` Nick LeRoy
2001-11-22 18:51       ` Andreas Bombe
2001-11-20 18:09   ` Luís Henriques
2001-11-21 14:37 Joerg Pommnitz
     [not found] <sbfa4d3a.051@MAIL-SMTP.uvsc.edu>
2001-11-21 10:49 ` Luís Henriques
  -- strict thread matches above, loose matches on Subject: below --
2001-11-20 16:40 Luis Miguel Correia Henriques

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=20011120123915.W1308@lynx.no \
    --to=adilger@turbolabs.com \
    --cc=aia21@cam.ac.uk \
    --cc=lhenriques@criticalsoftware.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox