Message ID | 20231222074605.452452-2-leobras@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05E81C46CD4 for <linux-mm@archiver.kernel.org>; Fri, 22 Dec 2023 07:46:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0ED506B0075; Fri, 22 Dec 2023 02:46:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 09DC66B0078; Fri, 22 Dec 2023 02:46:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E7FEB6B007B; Fri, 22 Dec 2023 02:46:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D4AD46B0075 for <linux-mm@kvack.org>; Fri, 22 Dec 2023 02:46:41 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A8131140338 for <linux-mm@kvack.org>; Fri, 22 Dec 2023 07:46:41 +0000 (UTC) X-FDA: 81593672202.14.88FB659 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf26.hostedemail.com (Postfix) with ESMTP id A1D2214001C for <linux-mm@kvack.org>; Fri, 22 Dec 2023 07:46:39 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gjULgw2E; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.hostedemail.com: domain of leobras@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=leobras@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703231199; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9dWOLJ/7H2GD4Bb9fMRINczeyfjJ7YRASwlhClz2V/8=; b=5ZTb3X6S2yAiPER58jblqqGqjjnTAvykMLu7KfVmsot5MU1zTu8qSB6QDL1ontBYwTW5du AolHFbHx1iS3kkYAGffQvvEaiwuU6rfwl4YY0KpQs/FXkAggKBbgANzdbTtfOKcTZUtvip lW4f/x1dyBgCBE5ZT/jIrdr7qT8O1hA= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gjULgw2E; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.hostedemail.com: domain of leobras@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=leobras@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703231199; a=rsa-sha256; cv=none; b=vCX5qlPAZJvexEQBZmjnqr31HLUPk+VvQQHzMOiwyoIkgLidxJ1PF+JjFbuH2kamXMh5+N MSwtyzNKePx1+2aVpmVPRLmFEK0agRJcUbpqgliJBg1P76mrId1aji8aiSs19a+0EavmfS MQbg8M9xpvimgtH9lXzkfHZQHDkGvaQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703231199; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9dWOLJ/7H2GD4Bb9fMRINczeyfjJ7YRASwlhClz2V/8=; b=gjULgw2ERygmkaSCWZ7fwpOSzXijqvBwPgrmxOT0ZhgsuhWah0uN1KWg7yLigInYPCern+ aC7fAbNmcDUlPl0xFez5KKBTeOifSLNDoyjHyCNFojrCz4INkM6NxDeC0aaPkZg9TdrpoP jvYI9npEoHtg3xmZDKAhem3mNyqHGj8= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-7DrFq8AwPjGpwQwdmVyOYw-1; Fri, 22 Dec 2023 02:46:37 -0500 X-MC-Unique: 7DrFq8AwPjGpwQwdmVyOYw-1 Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-3bb761408f9so1723437b6e.2 for <linux-mm@kvack.org>; Thu, 21 Dec 2023 23:46:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703231196; x=1703835996; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9dWOLJ/7H2GD4Bb9fMRINczeyfjJ7YRASwlhClz2V/8=; b=cS2Vr8v35H+YTIxoAxmr7LlWjnrdHpHDhyW1W9H1Zqx2ouj7f2zs+ihVz9XNPiEg5F 31/QOY1f6rWxg45p1X3J3ltjfT2MhZm9b3rZKyRrnPSAD4XAuGXwE7qkY6S6C9PEqPXJ N+ncROi4ik0gwGeSNrvZlTh7K97Bc4gNbVM55nYQOQ6Sq3QEOtRgrkjvoz011dUG1OK0 sDHd5CFMyA6qlihuONK3T3mwD0TtCAu/1tRWF6BOgstibakXyQRkp3IvyOxckauP03D9 UO4jI/3E8XuhCeXHEHGTdaUQN/sIaT3Gu6w4IqNuR7WPMFuwzCbdOxU0Vr93OncXii64 9qsw== X-Gm-Message-State: AOJu0Yx26JOKBQlyoT1ZJJhzGwaIHBh3Yb3YkUo5KVvYDjiQIkfj8bDU e2GA3zU3BIDImlr8fRA04c/mb/ldxdMMuH8J4ave5gefD5vFLjTmiysJ9IlwFrt/JdfVv6lM/me RFcX/75cEcx0mvi3XEm0= X-Received: by 2002:a05:6808:218e:b0:3a8:7c67:7cd with SMTP id be14-20020a056808218e00b003a87c6707cdmr1261209oib.24.1703231196681; Thu, 21 Dec 2023 23:46:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6noE7Pu5xAXvjh6CjMsnvaqxm6CqicXC5ZlFE2NmSpCIPLtETaqNzkTmN5ZP4z5PF3/bRXQ== X-Received: by 2002:a05:6808:218e:b0:3a8:7c67:7cd with SMTP id be14-20020a056808218e00b003a87c6707cdmr1261182oib.24.1703231196440; Thu, 21 Dec 2023 23:46:36 -0800 (PST) Received: from localhost.localdomain ([2804:1b3:a802:7496:88a7:1b1a:a837:bebf]) by smtp.gmail.com with ESMTPSA id m2-20020a62f202000000b006d97eaba6cesm1527015pfh.21.2023.12.21.23.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 23:46:35 -0800 (PST) From: Leonardo Bras <leobras@redhat.com> To: Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Eric Biederman <ebiederm@xmission.com>, Kees Cook <keescook@chromium.org>, Oleg Nesterov <oleg@redhat.com>, Leonardo Bras <leobras@redhat.com>, Conor Dooley <conor.dooley@microchip.com>, Andy Chiu <andy.chiu@sifive.com>, Greg Ungerer <gerg@kernel.org>, Vincent Chen <vincent.chen@sifive.com>, Xiao Wang <xiao.w.wang@intel.com>, Charlie Jenkins <charlie@rivosinc.com>, Andrew Morton <akpm@linux-foundation.org>, Alexandre Ghiti <alexghiti@rivosinc.com>, Kemeng Shi <shikemeng@huaweicloud.com>, David Hildenbrand <david@redhat.com>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Qinglin Pan <panqinglin2020@iscas.ac.cn>, Greentime Hu <greentime.hu@sifive.com>, =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= <bjorn@rivosinc.com>, =?utf-8?b?Q2zDqW1l?= =?utf-8?b?bnQgTMOpZ2Vy?= <cleger@rivosinc.com>, Guo Ren <guoren@kernel.org> Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 1/4] riscv: Replace direct thread flag check with is_compat_task() Date: Fri, 22 Dec 2023 04:46:01 -0300 Message-ID: <20231222074605.452452-2-leobras@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222074605.452452-1-leobras@redhat.com> References: <20231222074605.452452-1-leobras@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Queue-Id: A1D2214001C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: p9bue7fk1m8k5hyjawwxm38q6bfei7hb X-HE-Tag: 1703231199-621799 X-HE-Meta: U2FsdGVkX1+AeiHzAG7c9LNm+/Qvp+oeaMnKrRhysze3BBcz5pcXB+AoH58tmJGPyDG8VUpF8/fVaZfXgsR5Lm0Q44iCNoEJAsj4sbADwvxnNKRejBhwU7JpADhmmFXvVPBbIbPbluxyBsm1tJKfSdXGuDWLL94OoYoEdsER/tv1gwPBVV61pxJffvswnBdD264JGYLJVUL1qUlvxhtnjBApyREVYx1d8Pb4OXgjd0xHHoi7lgQtufjtDt+o8QHburB2571/PrK4yywd+XUpczwykNsR4PdfcmyHd6XZjaSTicKn8ez66ij/WZvbWkekvG7haMOKs/Iuzk9ZPr9ReNjfIdn9NqMQQtXt+PhZeceeast5kx9NmtFmbP/V1vLYBY2TAnIBDULs5tALYvAFjxYFSnCp1Z2TcnkLxhfgvVTWP0fqcTYSb7vXJUI7xrfLcUTA6a2+g6Z21eWtosfqKZggDOWo+gPASoC2TcAdzRPlNkxXGTQp7jA2rT+pClSs4I0GrlHo7nqyFD6/99aAVnnYqKcvP4fGxxPttanxMOhBv0Nb31FPKcUZ2jL9/BA1NmqpWIe16O08Pt6HrGFT2NFK560xYDCL79p/jweJ4fCyRMi9Nb/vBhwyZv9115JZp1WpPeTeDdE0iVVbAAHgC05iVec7/drFXaiw5f9dtmPhQfrdwtdSAab5s32qrablRX3rK0MGhQ0gquKpjs+BlONMszTzEbibUyAKHLvNabmHyT+Go55qWUGuxQ9Pk9Xk0yYmVi7wJblrTCS0+d3MFlMsEqU4EZ2SJwb9Zk1Ka397YPYFl6uGzypLeysXae0h9eWvrBlgoxNjLc03/hrS3tluy+ZQXBKdp1emb6nirhGWkxr1sha7M8oSfr0oNdX1nf1nuE/5pig7O219DGr13/PiXrGhwZCWxqmQS+PFtl/yOYlDRpYrjYZICRsSUtwT1nRF+9rHdE6wBMj7E6W PJWjUaa7 JpA8roWcZ4DR/q4U4p/eiK1LO6ILEnfx5vaBm2tFyRO1Hd1PYZXl9c1LcYykDFxx1p/BpuNb52zbHmGvPClschEJmzsu69SePYW0oH0gtAZ5OWE7jd9W2O6UNgs33RF/B6mTeDoeCswogzDPeBx9Cf/PoY2A6s4h7XTpwZ0JdhWtVhA9kQ9WD2eGjzuvR+1zR9BUGj925TAXGZeKdiCQU+ei/BzpPAyFuCfRAenWeqW/LLE0QMnMDL2NqasYoyg6JX9aVpTYx0FEvWW+mQ9GgdXZSHmPSLEe7L0rNz2riOYbxQGm33Zpkze7i8xPwkZ+4CZuvWSfgtXfzIBekAdTW2sWwdvXJN+DsVyUZphkEIFp4kn1zlc5BA7nRQqZGIp2svasm5Vw5Xl3SGuxfYhar6MLcvFG4YkcfaZDhZfqrCQImERjvUq3khm1sLwcOMVT7LK18 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Introduce & Optimize compat-mode helpers
|
expand
|
diff --git a/arch/riscv/include/asm/elf.h b/arch/riscv/include/asm/elf.h index 06c236bfab53b..59a08367fddd7 100644 --- a/arch/riscv/include/asm/elf.h +++ b/arch/riscv/include/asm/elf.h @@ -54,7 +54,7 @@ extern bool compat_elf_check_arch(Elf32_Ehdr *hdr); #ifdef CONFIG_64BIT #ifdef CONFIG_COMPAT -#define STACK_RND_MASK (test_thread_flag(TIF_32BIT) ? \ +#define STACK_RND_MASK (is_compat_task() ? \ 0x7ff >> (PAGE_SHIFT - 12) : \ 0x3ffff >> (PAGE_SHIFT - 12)) #else diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index ab00235b018f8..1d472b31e0cfe 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -882,7 +882,7 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte) #ifdef CONFIG_COMPAT #define TASK_SIZE_32 (_AC(0x80000000, UL) - PAGE_SIZE) -#define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ +#define TASK_SIZE (is_compat_task() ? \ TASK_SIZE_32 : TASK_SIZE_64) #else #define TASK_SIZE TASK_SIZE_64
There is some code that detects compat mode into a task by checking the flag directly, and other code that check using the helper is_compat_task(). Since the helper already exists, use it instead of checking the flags directly. Signed-off-by: Leonardo Bras <leobras@redhat.com> --- arch/riscv/include/asm/elf.h | 2 +- arch/riscv/include/asm/pgtable.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)