Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
KILLALL, KILL, XKILL or FUSER -k doesn't work!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
pinnockio
Apprentice
Apprentice


Joined: 08 Jun 2002
Posts: 162

PostPosted: Wed May 14, 2003 10:56 am    Post subject: KILLALL, KILL, XKILL or FUSER -k doesn't work! Reply with quote

Hello,

How do I force Linux to free a resource? The problem is that when mplayer wants to read a bad CD on my DVD-player, the DVD keeps on spinning up and down,lookinig for the requested data.

Whether I kill, xkill, killall or fuser -k the process associated with it,
the mplayer keeps on being listed when I use the top command. The only remedy to solve this is to reboot the pc. (What is really a pain in the ass, when you have a lot of such CD's :'().

Does anyone know a command or something to force linux to free the hardware resource?

Kind regards,

A belgian Gentoo user
Back to top
View user's profile Send private message
pinnockio
Apprentice
Apprentice


Joined: 08 Jun 2002
Posts: 162

PostPosted: Wed May 14, 2003 1:26 pm    Post subject: Reply with quote

Hello,

I think the problem is caused by the read-ahead of the DVD-player. It must have a quite large buffer, so it takes a while before it eventually stops trying to read (in the end it does, but the spinning up and down
is really annoying and all the other devices on that ide-bus suffer performance or access).

Under windows, you simply open the cd/dvd-tray and everything is solved :p. In linux, the trays are default locked (see the cdrom.c code in /usr/local/src/linux). You could change this value to zero in this source code before you compile the kernel. Or you could change this setting in /proc/sys/dev/cdrom/lock to 0. The problem with the latter is that this setting gets lost in between boots. Just write a simple script that does this for you and add it to the default or boot runlevel.

eg.:
#!/sbin/runscript
startf(){
ebegin "Unlocking the cd-trays"
echo 0 > /proc/sys/dev/cdrom/lock
eend $?
}

Now you have to keep in mind to unmount a cd/ dvd in between change of cd's or dvd's (as with floppies).

Kind regards,

A belgian Gentoo user

btw.: Does anybody know to lower the amount of read-ahead sectors for some device WITHOUT using hdparm (because all the suggestions with scsi-ide emulation enabled or not is to confusing and not error-prone).
Back to top
View user's profile Send private message
amne
Bodhisattva
Bodhisattva


Joined: 17 Nov 2002
Posts: 6378
Location: Graz / EU

PostPosted: Wed May 14, 2003 3:06 pm    Post subject: Reply with quote

killall -9 mplayer
should do it, may take a few minutes until everything returns to normal state.

regards,
an austrian gentoo user :D
Back to top
View user's profile Send private message
pinnockio
Apprentice
Apprentice


Joined: 08 Jun 2002
Posts: 162

PostPosted: Wed May 14, 2003 3:37 pm    Post subject: Reply with quote

Like I said,

I tried every kill command with every possible switch. Even kill with the options 1 through 34. (So 9 was included,... .)

Kind regards

A belgian Gentoo user
Back to top
View user's profile Send private message
dma
Guru
Guru


Joined: 31 Jan 2003
Posts: 437
Location: Charlotte, NC, USA

PostPosted: Wed May 14, 2003 3:46 pm    Post subject: Reply with quote

pinnockio wrote:
Hello,

#!/sbin/runscript
startf(){
ebegin "Unlocking the cd-trays"
echo 0 > /proc/sys/dev/cdrom/lock
eend $?
}

Now you have to keep in mind to unmount a cd/ dvd in between change of cd's or dvd's (as with floppies).

Kind regards,

A belgian Gentoo user

btw.: Does anybody know to lower the amount of read-ahead sectors for some device WITHOUT using hdparm (because all the suggestions with scsi-ide emulation enabled or not is to confusing and not error-prone).


Just put:
Code:
dev.cdrom.lock = 0


in /etc/sysctl.conf

:-)

Dunno if this works:
Code:
/* readahead -- set & get the read_ahead value for the specified device
*/

#include "stdio.h"
#include "stdlib.h"
#include "linux/fs.h"
#include "asm/fcntl.h"

void usage()
{
  printf( "usage:  readahead <device> [newvalue]\n" );

}/* usage() */


int main( int args, char **argv )
{
  int fd;
  int oldvalue;
  int newvalue;

  if ( args <= 1 ) {
    usage();
    return(1);
  }

  if ( args >= 3 && !isdigit(argv[2][0]) ) {
    printf( "readahead: invalid number.\n" );
    return(1);
  }

  fd = open( argv[1], O_RDONLY );
  if ( fd == -1 ) {
    printf( "readahead: unable to open device %s\n", argv[1] );
    return(1);
  }

  if ( ioctl(fd, BLKRAGET, &oldvalue) ) {
    printf( "readahead: unable to get read_ahead value from "
            "device %s\n", argv[1] );
    close (fd);
    return(1);
  }

  if ( args >= 3 ) {
    newvalue = atoi( argv[2] );
    if ( ioctl(fd, BLKRASET, newvalue) ) {
      printf( "readahead: unable to set %s's read_ahead to %d\n",
              argv[1], newvalue );
      close (fd);
      return(1);
    }
  }
  else {
    printf( "%d\n", oldvalue );
  }

  close (fd);
  return(0);

}/* main */
Back to top
View user's profile Send private message
pinnockio
Apprentice
Apprentice


Joined: 08 Jun 2002
Posts: 162

PostPosted: Thu May 15, 2003 12:11 am    Post subject: Reply with quote

Hello,

DMA Thanx for your reply!

Doesn't there exist a manual about the different configuration files and their setting? I mean, I've never heard about an /etc/sysctl.conf and if I would have known it, I surely would not know what different parameters I could put in there. (Do you know a good reference (book, online oa.) you would recommend for all such things? I mean, sometimes its getting such a mess not having any good background about such things (I mean, a little bit messing in /dev/, sometimes in /proc/, sometimes in dark config-files in /etc/,... . In the long term this is just waisting time :'().

And the second part: where do I put the read-ahead code you proposed? :oops:

Kind Regards,

A belgian Gentoo user
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum