[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [dm-devel] [ANNOUNCE] multipath-tools-0.4.4

On 2005-04-25T00:26:58, christophe varoqui <christophe varoqui free fr> wrote:

> 	* the daemon sets /proc/self/oom_adj to -17, hence is 
> 	  protected from the oom killer. Watch out for leaks.

I just cross-checked this. Quoting /usr/src/linux/fs/proc/base.c:
static ssize_t oom_adjust_write(struct file * file, const char * buf,
                                size_t count, loff_t *ppos)
        struct task_struct *task = proc_task(file->f_dentry->d_inode);
        char buffer[8], *end;
        int oom_adjust;

        if (!capable(CAP_SYS_RESOURCE))
                return -EPERM;
        memset(buffer, 0, 8);   
        if (count > 6)
                count = 6;
        if (copy_from_user(buffer, buf, count)) 
                return -EFAULT;
        oom_adjust = simple_strtol(buffer, &end, 0);
        if (oom_adjust < -16 || oom_adjust > 15)
                return -EINVAL;
        if (*end == '\n')
        task->oomkilladj = oom_adjust;
        if (end - buffer == 0) 
                return -EIO;
        return end - buffer;

I doubt that set_oom_adj() has ever worked, unless your kernel is different
from mine in this regard... Checking the return value on fprintf()/fclose()
might have caught this earlier.

    Lars Marowsky-Brée <lmb suse de>

High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX Products GmbH - A Novell Business

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]