Re: [Patch] Per kthread freezer flags

From: Peter Osterlund
Date: Fri Jul 30 2004 - 07:16:33 EST


Pavel Machek <pavel@xxxxxx> writes:

> Hi!
>
> > > > - pd->cdrw.thread = kthread_run(kcdrwd, pd, "%s", pd->name);
> > > > + pd->cdrw.thread = kthread_run(kcdrwd, pd, "%s", 0, pd->name);
> > > > if (IS_ERR(pd->cdrw.thread)) {
> > > > printk("pktcdvd: can't start kernel thread\n");
> > > > ret = -ENOMEM;
> > >
> > > What if someone does swapon /dev/pktdvd0?
> >
> > Sorry. That's my ignorance. I thought the packet writer was only for
> > writing :>

pktcdvd devices are standard writable block devices, so you can use
them for anything you want, including swapping.

> Well, swapon /dev/pktdvd would be *very* bad idea as optical drives
> are very slow,

Agreed. Seek times before writes are in the range of 500-1000ms on my
drives. This will probably make your machine unresponsive for a *very*
long time when you start to swap to an optical disc.

It should work though, unless you wear out your disc before it's done
swapping, in which case nasty things will probably happen. I don't
think I/O errors on a swap device can be handled in a sane way by the
kernel.

> but PF_NOFREEZE is more correct here.

Yes. What about this code in the main loop in kcdrwd?

/* make swsusp happy with our thread */
if (current->flags & PF_FREEZE)
refrigerator(PF_FREEZE);

Should it still be there when the task is marked as PF_NOFREEZE?

--
Peter Osterlund - petero2@xxxxxxxxx
http://w1.894.telia.com/~u89404340
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/