From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224XsLRYcc6a6JQNSWcOKTKoEP0ZuLAcTbDZiIbjJG3jmWeBAAMmHNPtlPpU35aQfEsPYe62 ARC-Seal: i=1; a=rsa-sha256; t=1517166183; cv=none; d=google.com; s=arc-20160816; b=QNjOhjvqWTJRX/2+NjtXU2axfYKlvjU1xV4ngnetxXPp7fErYJEoljpuyiwJbgbDDp /ixHGDeEnnFhRkHbNLFKaVurcK4W+m1kg3dHDbZv+Zc1Tx1JcamLUUykASht++Y1wZ+8 vTuxTmTuYoSv9R20o+keZ666zKUpdrPVzV2ySGD1+vE2kv+jdpjB6nSN40qzGm6T6kSg WP7hGugOvd/pqrq2350ejgj+9H3Ei4HWl6+J7kAVrcgp1Y4SpyuSEaXoWorKjGwhSzv0 tkgf0xa21JKybawpIz79lsFONJ8wwzGWWVaRpw5/snwo79FQ/BD+191rB3CZN0ok0fkQ GCkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:user-agent:in-reply-to:content-disposition:mime-version :references:message-id:cc:to:from:date:sender:dkim-signature :delivered-to:list-id:list-subscribe:list-unsubscribe:list-help :list-post:precedence:mailing-list:arc-authentication-results; bh=UaU/CFmlnYaYK9oQ1/4MGJo3mOB9+J5jrzDLm4lzy34=; b=rRF6zX7M+RElaob2RUxuP5EfIwJSYjry02z+TA9ncy2xAzyY/geFlTVio8tK44U7xZ AG7NMFj66JsKSSEs3igCzxUmltSRiHZv8xx2SDLC0WNvZ1gxDqy+wto0tVgfJac+9y6k m56FO7XjEzHGhNaAmcwTQeGwDeGpLn1PyJPxcJHb357dJoiNlitquewwpVJJOrhIw8j8 VQ123c0NCmnfoPIUL6uOWcET3JIsHtpPG7xLqab2ctFSA/gxi/1AWKGANfrjPHEfTm+O JYG2Kg6cWBz90vjHWu4e/3on4jUFiXnBgBWcIF47FehqHtg9kFQJ/PYlUm1a+64DpAyQ l6kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OhpcA/pQ; spf=pass (google.com: domain of kernel-hardening-return-11494-gregkh=linuxfoundation.org@lists.openwall.com designates 195.42.179.200 as permitted sender) smtp.mailfrom=kernel-hardening-return-11494-gregkh=linuxfoundation.org@lists.openwall.com Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OhpcA/pQ; spf=pass (google.com: domain of kernel-hardening-return-11494-gregkh=linuxfoundation.org@lists.openwall.com designates 195.42.179.200 as permitted sender) smtp.mailfrom=kernel-hardening-return-11494-gregkh=linuxfoundation.org@lists.openwall.com Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: Sender: Ingo Molnar Date: Sun, 28 Jan 2018 20:02:43 +0100 From: Ingo Molnar To: Andy Lutomirski Cc: x86@kernel.org, LKML , Linus Torvalds , Kernel Hardening , Borislav Petkov Message-ID: <20180128190243.gp3ner27uhsnnjpb@gmail.com> References: <03148bcc1b217100e6e8ecf6a5468c45cf4304b6.1517164461.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <03148bcc1b217100e6e8ecf6a5468c45cf4304b6.1517164461.git.luto@kernel.org> User-Agent: NeoMutt/20170609 (1.8.3) Subject: [kernel-hardening] Re: [PATCH 2/3] x86/asm: Move 'status' from thread_struct to thread_info X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590862581130478609?= X-GMAIL-MSGID: =?utf-8?q?1590864047990884406?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: * Andy Lutomirski wrote: > The TS_COMPAT bit is very hot and is accessed from code paths that > mostly also touch thread_info::flags. Move it into struct > thread_info to improve cache locality. > > The only reason it was in thread_struct is that there was a brief > period during which we didn't allow arch-specific fields in struct > thread_info. > > Linus suggested further changing: > > ti->status &= ~(TS_COMPAT|TS_I386_REGS_POKED); > > to: > > if (unlikely(ti->status & (TS_COMPAT|TS_I386_REGS_POKED))) > ti->status &= ~(TS_COMPAT|TS_I386_REGS_POKED); > > on the theory that frequently dirtying the cacheline even in pure > 64-bit code that never needs to modify status hurts performance. > That could be a reasonable followup patch, but I suspect it matters > less on top of this patch. > > Suggested-by: Linus Torvalds > Signed-off-by: Andy Lutomirski > --- > arch/x86/entry/common.c | 4 ++-- > arch/x86/include/asm/processor.h | 2 -- > arch/x86/include/asm/syscall.h | 6 +++--- > arch/x86/include/asm/thread_info.h | 3 ++- > arch/x86/kernel/process_64.c | 4 ++-- > arch/x86/kernel/ptrace.c | 2 +- > arch/x86/kernel/signal.c | 2 +- > 7 files changed, 11 insertions(+), 12 deletions(-) Reviewed-by: Ingo Molnar Thanks, Ingo