lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6599ad830802231148w518d937cyd75d1d0a35702d9d@mail.gmail.com>
Date:	Sat, 23 Feb 2008 11:48:23 -0800
From:	"Paul Menage" <menage@...gle.com>
To:	"Peter Zijlstra" <a.p.zijlstra@...llo.nl>
Cc:	"Ingo Molnar" <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	tong.n.li@...el.com
Subject: Re: [PATCH 3/8] sched: rt-group: interface

On Mon, Feb 4, 2008 at 1:03 PM, Peter Zijlstra <a.p.zijlstra@...llo.nl> wrote:
>  +static int cpu_rt_runtime_write(struct cgroup *cgrp, struct cftype *cft,
>  +                               struct file *file,
>  +                               const char __user *userbuf,
>  +                               size_t nbytes, loff_t *unused_ppos)
>  +{
>  +       char buffer[64];
>  +       int retval = 0;
>  +       s64 val;
>  +       char *end;
>  +
>  +       if (!nbytes)
>  +               return -EINVAL;
>  +       if (nbytes >= sizeof(buffer))
>  +               return -E2BIG;
>  +       if (copy_from_user(buffer, userbuf, nbytes))
>  +               return -EFAULT;
>  +
>  +       buffer[nbytes] = 0;     /* nul-terminate */
>  +
>  +       /* strip newline if necessary */
>  +       if (nbytes && (buffer[nbytes-1] == '\n'))
>  +               buffer[nbytes-1] = 0;
>  +       val = simple_strtoll(buffer, &end, 0);
>  +       if (*end)
>  +               return -EINVAL;
>  +
>  +       /* Pass to subsystem */
>  +       retval = sched_group_set_rt_runtime(cgroup_tg(cgrp), val);
>  +       if (!retval)
>  +               retval = nbytes;
>  +       return retval;
>   }
>
>  -static u64 cpu_rt_ratio_read_uint(struct cgroup *cgrp, struct cftype *cft)
>  -{
>  -       struct task_group *tg = cgroup_tg(cgrp);
>  +static ssize_t cpu_rt_runtime_read(struct cgroup *cgrp, struct cftype *cft,
>  +                                  struct file *file,
>  +                                  char __user *buf, size_t nbytes,
>  +                                  loff_t *ppos)
>  +{
>  +       char tmp[64];
>  +       long val = sched_group_rt_runtime(cgroup_tg(cgrp));
>  +       int len = sprintf(tmp, "%ld\n", val);
>
>  -       return (u64) tg->rt_ratio;
>  +       return simple_read_from_buffer(buf, nbytes, ppos, tmp, len);
>   }

What's the reason that you can't use the cgroup read_uint/write_uint
methods for this? Is it just because you have -1 as your "unlimited"
value.

If so, could we avoid that problem by using 0 rather than -1 as the
"unlimited" value? It looks from what I've read in the Documentation
changes as though 0 isn't really a meaningful value.

Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ