On Thu, 29 Dec 2011 06:52:18 +0000
Bastian Bittorf <[email protected]> wrote:
> > > A better way would be IMHO to use a cron.minutely which fire's
> > > an ioctl to /dev/watchdog. if crond is removed, the device
> > should
> > > reboot. so i need a way to invoke an ioctl from shellscript.
> >
> > I think this doesn't work.
>
> in our special case it would work, because all "daemon-checking"
> is done via cron. so if cron fails everything is not working anymore.
>
> > What you could try is increasing the likeliness of the watchdog
> > process
> > to get killed on OOM.
> > Setting /proc/WATCHDOGPID/oom_score_adj to 1000 will always kill
> > the watchdog
> > on any oom condition, as far as I can see.
>
> Thats seems like an interesting idea.
> As far i can read oom_kill.c this will add 100% to the oom_badness() of
> the watchdog-kicker, but the value is calculated based on memory-consumption.
> IMHO this is not enough, because even our mini-cron
> consumes more memory then the watchdog-kicker.
No, this is not true.
/*
* /proc/pid/oom_score_adj ranges from -1000 to +1000 such that it may
* either completely disable oom killing or always prefer a certain
* task.
*/
points += p->signal->oom_score_adj;
if (points <= 0)
return 1;
return (points < 1000) ? points : 1000;
This is done in a loop for every process and then the process with the highest
score, which is max 1000 and watchdog has 1000, is selected. It is
unlikely that there is another process which also has 1000 due to its memory
consumption only, that is selected first. And it's even unlikelier that cron
consumes 1000 points of badness. So cron will never be selected in favor of
watchdog.
> beside that:
> would'nt it be senseful to adjust "START=01" to /etc/init.d/watchdog
> and place something like this?
>
> pid="$( pidof watchdog )"
> echo "1000" >/proc/$pid/oom_score_adj
yeah, could do this.
--
Greetings, Michael.
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel