Skip to contentSkip to conversation

sched: Remove unused TASK_SIZE_OF

PATCH Superseded [email protected] 3 participants 14 messages Dec 21, 2021 – Dec 22, 2021

Subsystems (9)
x86 PowerPC MIPS RISC-V +5 more subsystems

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover sched: Remove unused TASK_SIZE_OF

From: Guo Ren <[email protected]>

This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture.

Guo Ren (8):
sched: Remove unused TASK_SIZE_OF
sched: x86: Remove unused TASK_SIZE_OF
sched: sparc: Remove unused TASK_SIZE_OF
sched: powerpc: Remove unused TASK_SIZE_OF
sched: s390: Remove unused TASK_SIZE_OF
sched: parisc: Remove unused TASK_SIZE_OF
sched: arm64: Remove unused TASK_SIZE_OF
sched: mips: Remove unused TASK_SIZE_OF

 arch/arm64/include/asm/processor.h      | 2 --
 arch/mips/include/asm/processor.h       | 3 ---
 arch/parisc/include/asm/processor.h     | 3 +--
 arch/powerpc/include/asm/task_size_64.h | 6 ++----
 arch/s390/include/asm/processor.h       | 3 +--
 arch/sparc/include/asm/processor_64.h   | 3 ---
 arch/x86/include/asm/page_64_types.h    | 2 --
 include/linux/sched.h                   | 4 ----
 8 files changed, 4 insertions(+), 22 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/8 sched: Remove unused TASK_SIZE_OF

From: Guo Ren <[email protected]>

This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture.

---
 include/linux/sched.h | 4 ----
 1 file changed, 4 deletions(-)
include/linux/sched.h +0 -4
index 78c351e35fec..8e5689d06ac8 100644
@@ -2166,10 +2166,6 @@ static inline bool vcpu_is_preempted(int cpu)
 extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
 extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
 
-#ifndef TASK_SIZE_OF
-#define TASK_SIZE_OF(tsk)	TASK_SIZE
-#endif
-
 #ifdef CONFIG_SMP
 /* Returns effective CPU energy utilization, as seen by the scheduler */
 unsigned long sched_cpu_util(int cpu, unsigned long max);
Signature · 1 line
2.25.1
#3 lore raw

PATCH 2/8 sched: x86: Remove unused TASK_SIZE_OF

In reply to [email protected]

From: Guo Ren <[email protected]>

This macro isn't used in Linux, now. Delete in
include/linux/sched.h and arch's include/asm.

---
 arch/x86/include/asm/page_64_types.h | 2 --
 1 file changed, 2 deletions(-)
arch/x86/include/asm/page_64_types.h +0 -2
index e9e2c3ba5923..6191cf417c31 100644
@@ -74,8 +74,6 @@
 					IA32_PAGE_OFFSET : DEFAULT_MAP_WINDOW)
 #define TASK_SIZE		(test_thread_flag(TIF_ADDR32) ? \
 					IA32_PAGE_OFFSET : TASK_SIZE_MAX)
-#define TASK_SIZE_OF(child)	((test_tsk_thread_flag(child, TIF_ADDR32)) ? \
-					IA32_PAGE_OFFSET : TASK_SIZE_MAX)
 
 #define STACK_TOP		TASK_SIZE_LOW
 #define STACK_TOP_MAX		TASK_SIZE_MAX
Signature · 1 line
2.25.1
#4 lore raw

PATCH 3/8 sched: sparc: Remove unused TASK_SIZE_OF

In reply to [email protected]

From: Guo Ren <[email protected]>

This macro isn't used in Linux, now. Delete in
include/linux/sched.h and arch's include/asm.

---
 arch/sparc/include/asm/processor_64.h | 3 ---
 1 file changed, 3 deletions(-)
arch/sparc/include/asm/processor_64.h +0 -3
index ae851e8fce4c..628349fc4cdd 100644
@@ -27,9 +27,6 @@
 #define VPTE_SIZE	(1 << (VA_BITS - PAGE_SHIFT + 3))
 #endif
 
-#define TASK_SIZE_OF(tsk) \
-	(test_tsk_thread_flag(tsk,TIF_32BIT) ? \
-	 (1UL << 32UL) : ((unsigned long)-VPTE_SIZE))
 #define TASK_SIZE \
 	(test_thread_flag(TIF_32BIT) ? \
 	 (1UL << 32UL) : ((unsigned long)-VPTE_SIZE))
Signature · 1 line
2.25.1
#5 lore raw

PATCH 4/8 sched: powerpc: Remove unused TASK_SIZE_OF

In reply to [email protected]

From: Guo Ren <[email protected]>

This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm.

---
 arch/powerpc/include/asm/task_size_64.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/task_size_64.h +2 -4
index c993482237ed..7e2eca4fac4d 100644
@@ -44,12 +44,10 @@
  */
 #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
 
-#define TASK_SIZE_OF(tsk)						\
-	(test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :	\
+#define TASK_SIZE							\
+	(test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :	\
 						TASK_SIZE_USER64)
 
-#define TASK_SIZE TASK_SIZE_OF(current)
-
 #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
 #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))
 
Signature · 1 line
2.25.1
#10 lore raw

PATCH 5/8 sched: s390: Remove unused TASK_SIZE_OF

In reply to [email protected]

From: Guo Ren <[email protected]>

This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm.

---
 arch/s390/include/asm/processor.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/s390/include/asm/processor.h +1 -2
index f54c152bf2bf..605bc57a5ffc 100644
@@ -88,11 +88,10 @@ extern void __bpon(void);
  * User space process size: 2GB for 31 bit, 4TB or 8PT for 64 bit.
  */
 
-#define TASK_SIZE_OF(tsk)	(test_tsk_thread_flag(tsk, TIF_31BIT) ? \
+#define TASK_SIZE		(test_tsk_thread_flag(current, TIF_31BIT) ? \
 					_REGION3_SIZE : TASK_SIZE_MAX)
 #define TASK_UNMAPPED_BASE	(test_thread_flag(TIF_31BIT) ? \
 					(_REGION3_SIZE >> 1) : (_REGION2_SIZE >> 1))
-#define TASK_SIZE		TASK_SIZE_OF(current)
 #define TASK_SIZE_MAX		(-PAGE_SIZE)
 
 #define STACK_TOP		(test_thread_flag(TIF_31BIT) ? \
Signature · 1 line
2.25.1
#11 lore raw

PATCH 6/8 sched: parisc: Remove unused TASK_SIZE_OF

In reply to [email protected]

From: Guo Ren <[email protected]>

This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm.

---
 arch/parisc/include/asm/processor.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/parisc/include/asm/processor.h +1 -2
index b669f4b9040b..d9c8dc76ee6a 100644
@@ -23,8 +23,7 @@
 
 #define HAVE_ARCH_PICK_MMAP_LAYOUT
 
-#define TASK_SIZE_OF(tsk)       ((tsk)->thread.task_size)
-#define TASK_SIZE	        TASK_SIZE_OF(current)
+#define TASK_SIZE               (current->thread.task_size)
 #define TASK_UNMAPPED_BASE      (current->thread.map_base)
 
 #define DEFAULT_TASK_SIZE32	(0xFFF00000UL)
Signature · 1 line
2.25.1
#12 lore raw

PATCH 7/8 sched: arm64: Remove unused TASK_SIZE_OF

In reply to [email protected]

From: Guo Ren <[email protected]>

This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm.

---
 arch/arm64/include/asm/processor.h | 2 --
 1 file changed, 2 deletions(-)
arch/arm64/include/asm/processor.h +0 -2
index 6f41b65f9962..d24dfb49237d 100644
@@ -65,8 +65,6 @@
 #endif /* CONFIG_ARM64_64K_PAGES */
 #define TASK_SIZE		(test_thread_flag(TIF_32BIT) ? \
 				TASK_SIZE_32 : TASK_SIZE_64)
-#define TASK_SIZE_OF(tsk)	(test_tsk_thread_flag(tsk, TIF_32BIT) ? \
-				TASK_SIZE_32 : TASK_SIZE_64)
 #define DEFAULT_MAP_WINDOW	(test_thread_flag(TIF_32BIT) ? \
 				TASK_SIZE_32 : DEFAULT_MAP_WINDOW_64)
 #else
Signature · 1 line
2.25.1
#13 lore raw

PATCH 8/8 sched: mips: Remove unused TASK_SIZE_OF

In reply to [email protected]

From: Guo Ren <[email protected]>

This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm.

---
 arch/mips/include/asm/processor.h | 3 ---
 1 file changed, 3 deletions(-)
arch/mips/include/asm/processor.h +0 -3
index 4bb24579d12e..8871fc5b0baa 100644
@@ -61,9 +61,6 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src
 #define TASK_SIZE (test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64)
 #define STACK_TOP_MAX	TASK_SIZE64
 
-#define TASK_SIZE_OF(tsk)						\
-	(test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64)
-
 #define TASK_IS_32BIT_ADDR test_thread_flag(TIF_32BIT_ADDR)
 
 #endif
Signature · 1 line
2.25.1
#2 lore raw
In reply to [email protected]
Quoted 8 lines · On Tue, Dec 21, 2021 at 6:00 PM <[email protected]> wrote:

From: Guo Ren <[email protected]>

This macro isn't used in Linux, now. Delete in include/linux/sched.h and arch's include/asm. This would confuse people who are implementing the COMPAT feature for architecture.

It would help to list how long it has been unused for. Looking through the git history, I see commit a06db751c321 ("pagemap: check permissions and capabilities at open time") removing the last user.

I would normally offer to take the entire series through the asm-generic tree, as I do for this kind of cross-architecture work. I'll probably not have time before the merge window to pick it up though, so it may be better to go through the architecture trees, or possibly linux-mm for anything that fails to get picked up.

For the series:

#6 lore raw

Re: [PATCH 4/8] sched: powerpc: Remove unused TASK_SIZE_OF

In reply to [email protected]

Le 21/12/2021 à 18:00, [email protected] a écrit :

Quoted 15 lines

From: Guo Ren <[email protected]>

This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm.

---
  arch/powerpc/include/asm/task_size_64.h | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/task_size_64.h +0 -0
index c993482237ed..7e2eca4fac4d 100644

arch/powerpc/include/asm/task_size_64.h line 49

Quoted 8 lines
arch/powerpc/include/asm/task_size_64.h +2 -2
@@ -44,12 +44,10 @@
   */
  #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
 
-#define TASK_SIZE_OF(tsk)						\
-	(test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :	\
+#define TASK_SIZE							\
+	(test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :	\
  						TASK_SIZE_USER64)

I think you should use test_thread_flag() instead.

Or even better: use is_32bit_task() and bring back this macro as a single line, something like:

#define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64)

Quoted 7 lines
arch/powerpc/include/asm/task_size_64.h +0 -2
-#define TASK_SIZE TASK_SIZE_OF(current)
-
  #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
  #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))
 
 
author
#7 lore raw

Re: [PATCH 4/8] sched: powerpc: Remove unused TASK_SIZE_OF

Quoted 30 lines · Christophe Leroy
Quoted 15 lines · Le 21/12/2021 à 18:00, [email protected] a écrit :

From: Guo Ren <[email protected]>

This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm.

---
  arch/powerpc/include/asm/task_size_64.h | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/task_size_64.h +0 -0
index c993482237ed..7e2eca4fac4d 100644

arch/powerpc/include/asm/task_size_64.h line 49

Quoted 8 lines
arch/powerpc/include/asm/task_size_64.h +2 -2
@@ -44,12 +44,10 @@
   */
  #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
 
-#define TASK_SIZE_OF(tsk)                                            \
-     (test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :      \
+#define TASK_SIZE                                                    \
+     (test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :  \
                                              TASK_SIZE_USER64)

I think you should use test_thread_flag() instead.

Quoted 4 lines

Or even better: use is_32bit_task() and bring back this macro as a single line, something like:

#define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64)

Okay, looks better. I would fix it in the next version.

Quoted 8 lines
Quoted 8 lines
arch/powerpc/include/asm/task_size_64.h +0 -2
-#define TASK_SIZE TASK_SIZE_OF(current)
-
  #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
  #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))
 
 
Signature · 4 lines
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/
#8 lore raw

Re: [PATCH 4/8] sched: powerpc: Remove unused TASK_SIZE_OF

Le 22/12/2021 à 04:02, Guo Ren a écrit :

Quoted 32 lines
Quoted 30 lines · Christophe Leroy
Quoted 15 lines · Le 21/12/2021 à 18:00, [email protected] a écrit :

From: Guo Ren <[email protected]>

This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm.

---
   arch/powerpc/include/asm/task_size_64.h | 6 ++----
   1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/task_size_64.h +0 -0
index c993482237ed..7e2eca4fac4d 100644

arch/powerpc/include/asm/task_size_64.h line 49

Quoted 8 lines
arch/powerpc/include/asm/task_size_64.h +2 -2
@@ -44,12 +44,10 @@
    */
   #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
 
-#define TASK_SIZE_OF(tsk)                                            \
-     (test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :      \
+#define TASK_SIZE                                                    \
+     (test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :  \
                                               TASK_SIZE_USER64)

I think you should use test_thread_flag() instead.

Quoted 5 lines
Quoted 4 lines

Or even better: use is_32bit_task() and bring back this macro as a single line, something like:

#define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64)

Okay, looks better. I would fix it in the next version.

Note that is_32bit_task() exists on powerpc, parisc and sparc.

For other ones you can still use test_thread_flag() instead of test_tsk_thread_flag(current)

author
#9 lore raw

Re: [PATCH 4/8] sched: powerpc: Remove unused TASK_SIZE_OF

Got it. Thx

Quoted 46 lines · Christophe Leroy
Quoted 32 lines · Guo Ren
Quoted 30 lines · Christophe Leroy
Quoted 15 lines · Le 21/12/2021 à 18:00, [email protected] a écrit :

From: Guo Ren <[email protected]>

This macro isn't used in Linux sched, now. Delete in include/linux/sched.h and arch's include/asm.

---
   arch/powerpc/include/asm/task_size_64.h | 6 ++----
   1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/task_size_64.h +0 -0
index c993482237ed..7e2eca4fac4d 100644

arch/powerpc/include/asm/task_size_64.h line 49

Quoted 8 lines
arch/powerpc/include/asm/task_size_64.h +2 -2
@@ -44,12 +44,10 @@
    */
   #define TASK_SIZE_USER32 (0x0000000100000000UL - (1 * PAGE_SIZE))
 
-#define TASK_SIZE_OF(tsk)                                            \
-     (test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 :      \
+#define TASK_SIZE                                                    \
+     (test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 :  \
                                               TASK_SIZE_USER64)

I think you should use test_thread_flag() instead.

Quoted 5 lines
Quoted 4 lines

Or even better: use is_32bit_task() and bring back this macro as a single line, something like:

#define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64)

Okay, looks better. I would fix it in the next version.

Note that is_32bit_task() exists on powerpc, parisc and sparc.

For other ones you can still use test_thread_flag() instead of test_tsk_thread_flag(current)

Signature · 4 lines
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/