Re: [PATCH] ARM: mm: Simplify act_mm macro
From: Linus Walleij <hidden>
Date: 2020-05-26 18:08:50
On Tue, May 26, 2020 at 4:37 PM Russell King - ARM Linux admin [off-list ref] wrote:
On Tue, May 26, 2020 at 04:32:49PM +0200, Linus Walleij wrote:quoted
The act_mm assembly macro is actually partly reimplementing get_thread_info so let's just use that. Suggested-by: Russell King <linux@armlinux.org.uk> Signed-off-by: Linus Walleij <redacted> --- arch/arm/mm/proc-macros.S | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S index 60ac7c5999a9..65eaea85d3d6 100644 --- a/arch/arm/mm/proc-macros.S +++ b/arch/arm/mm/proc-macros.S@@ -5,7 +5,6 @@ * VMA_VM_FLAGS * VM_EXEC */ -#include <linux/const.h> #include <asm/asm-offsets.h> #include <asm/thread_info.h>@@ -31,9 +30,7 @@ * act_mm - get current->active_mm */ .macro act_mm, rd - bic \rd, sp, #(THREAD_SIZE - 1) & ~63 - bic \rd, \rd, #63 - ldr \rd, [\rd, #TI_TASK] + get_thread_info \rdThis is not quite the same thing. get_thread_info loads into \rd the address of the thread_info structure. That's what the two bic instructions are doing. The LDR is then loading the address of the task_struct into \rd.quoted
.if (TSK_ACTIVE_MM > IMM12_MASK) add \rd, \rd, #TSK_ACTIVE_MM & ~IMM12_MASK .endifSo this change alters which structure \rd is pointing to.
Oh I see it. I need to keep the last ldr \rd, [\rd, #TI_TASK]. Strange that it wasn't crashing on me, I guess I was lucky. I'll respin, thanks! (The plan is to also make a patch to get_thread_info to use bic like you pointed out, I'm just slow with my assembly.) Yours, Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel