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: <20140319082655.GK22095@laptop.programming.kicks-ass.net>
Date:	Wed, 19 Mar 2014 09:26:55 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Dongsheng Yang <yangds.fnst@...fujitsu.com>
Cc:	linux-kernel@...r.kernel.org, joe@...ches.com, mingo@...nel.org,
	tglx@...utronix.de, heiko.carstens@...ibm.com
Subject: Re: [PATCH 08/17] ioprio: Add a macro named NICE_TO_IOPRIO.

On Tue, Mar 11, 2014 at 06:09:16PM +0800, Dongsheng Yang wrote:
> As the task nice value is in [-20, 19] and the io priority is in [0, 7],
> and the convert method from niceval to ioprio is implemented with an
> opened code in task_nice_ioprio().
> 
> This patch move the implementation to a macro NICE_TO_IOPRIO, making
> it more readable and modular.
> 
> Signed-off-by: Dongsheng Yang <yangds.fnst@...fujitsu.com>
> ---
>  include/linux/ioprio.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
> index beb9ce1..c0faa0b 100644
> --- a/include/linux/ioprio.h
> +++ b/include/linux/ioprio.h
> @@ -18,6 +18,11 @@
>  #define ioprio_valid(mask)	(IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE)
>  
>  /*
> + * Convert the nice value [19,-20] to io priority value [0,7].
> + */
> +#define NICE_TO_IOPRIO(nice)	(nice_to_rlimit(nice) / 5)
> +
> +/*
>   * These are the io priority groups as implemented by CFQ. RT is the realtime
>   * class, it always gets premium service. BE is the best-effort scheduling
>   * class, the default for any process. IDLE is the idle scheduling class, it
> @@ -52,7 +57,7 @@ enum {
>   */
>  static inline int task_nice_ioprio(struct task_struct *task)
>  {
> -	return (task_nice(task) + 20) / 5;
> +	return NICE_TO_IOPRIO(task_nice(task));
>  }

I'm still not seeing the point of adding that macro; if you want more
documentation; just add the comment.
--
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