Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1728116 > unrolled thread

[PATCH 4/4] sched/deadline: use C bitfields for the state flags

Started byluca abeni <luca.abeni@santannapisa.it>
First post2017-09-07 12:20 +0200
Last post2017-09-08 10:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/4] sched/deadline: use C bitfields for the state flags luca abeni <luca.abeni@santannapisa.it> - 2017-09-07 12:20 +0200
    Re: [PATCH 4/4] sched/deadline: use C bitfields for the state flags Daniel Bristot de Oliveira <bristot@redhat.com> - 2017-09-08 10:30 +0200

#1728116 — [PATCH 4/4] sched/deadline: use C bitfields for the state flags

Fromluca abeni <luca.abeni@santannapisa.it>
Date2017-09-07 12:20 +0200
Subject[PATCH 4/4] sched/deadline: use C bitfields for the state flags
Message-ID<un24F-71m-5@gated-at.bofh.it>
Ask the compiler to use a single bit for storing true / false values,
instead of wasting the size of a whole int value.
Tested with gcc 5.4.0 on x86_64, and the compiler produces the expected
Assembly (similar to the Assembly code generated when explicitly accessing
the bits with bitmasks, "&" and "|").

Signed-off-by: luca abeni <luca.abeni@santannapisa.it>
---
 include/linux/sched.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 68b3833..e03cc69 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -472,10 +472,10 @@ struct sched_dl_entity {
 	 * conditions between the inactive timer handler and the wakeup
 	 * code.
 	 */
-	int				dl_throttled;
-	int				dl_boosted;
-	int				dl_yielded;
-	int				dl_non_contending;
+	int				dl_throttled      : 1;
+	int				dl_boosted        : 1;
+	int				dl_yielded        : 1;
+	int				dl_non_contending : 1;
 
 	/*
 	 * Bandwidth enforcement timer. Each -deadline task has its
-- 
2.7.4

[toc] | [next] | [standalone]


#1728685

FromDaniel Bristot de Oliveira <bristot@redhat.com>
Date2017-09-08 10:30 +0200
Message-ID<unmPM-4eF-17@gated-at.bofh.it>
In reply to#1728116
On 09/07/2017 12:09 PM, luca abeni wrote:
> Ask the compiler to use a single bit for storing true / false values,
> instead of wasting the size of a whole int value.
> Tested with gcc 5.4.0 on x86_64, and the compiler produces the expected
> Assembly (similar to the Assembly code generated when explicitly accessing
> the bits with bitmasks, "&" and "|").
> 
> Signed-off-by: luca abeni <luca.abeni@santannapisa.it>

Reviewed-by: Daniel Bristot de Oliveira <bristot@redhat.com>

-- Daniel
> ---
>  include/linux/sched.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 68b3833..e03cc69 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -472,10 +472,10 @@ struct sched_dl_entity {
>  	 * conditions between the inactive timer handler and the wakeup
>  	 * code.
>  	 */
> -	int				dl_throttled;
> -	int				dl_boosted;
> -	int				dl_yielded;
> -	int				dl_non_contending;
> +	int				dl_throttled      : 1;
> +	int				dl_boosted        : 1;
> +	int				dl_yielded        : 1;
> +	int				dl_non_contending : 1;
>  
>  	/*
>  	 * Bandwidth enforcement timer. Each -deadline task has its
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web