From patchwork Wed Jan 3 16:00:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonardo Bras X-Patchwork-Id: 13510222 Return-Path: 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 D07B3C3DA6E for ; Wed, 3 Jan 2024 16:00:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C09D6B02C7; Wed, 3 Jan 2024 11:00:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1703A6B02CA; Wed, 3 Jan 2024 11:00:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 010C46B02CC; Wed, 3 Jan 2024 11:00:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E0FE26B02C7 for ; Wed, 3 Jan 2024 11:00:56 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AC99A14090E for ; Wed, 3 Jan 2024 16:00:56 +0000 (UTC) X-FDA: 81638463312.28.31056FE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 28CFD8001B for ; Wed, 3 Jan 2024 16:00:51 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=c5ROwIKR; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of leobras@redhat.com designates 170.10.129.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=1704297652; 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: references:dkim-signature; bh=kntl/nAgkMTrS0b6uVdfD+vMpj63I1IJoYMsR9G9+XQ=; b=OEtln2A4XXuqWHZjRWHUDrqo+/+ThHE+8Ur1QQYuPt3cSwhj7OYuyhZKdr/XuAmFE7PNDs 7/B36patBeLu41OPUh4GA616PXyGgn7A8t35ZopA2ZbsFFULcikgYXzWh88jGcAvJQQqlf 4rpQOZcAspZxNo1PEtnhC9q2xlrbYi8= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=c5ROwIKR; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of leobras@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=leobras@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704297652; a=rsa-sha256; cv=none; b=44bMej9Mc+f8PDg2jWAev8rPzkCIy4/MXiP5t2LxUDcx205OizR13fnEQXyXy/NUcO00yv lUsCGyNE0YvwmxTpxK1EvmVLiGXSHVxEPgLMxmwCSN7Y4pl7tlwcXgHKHf0rHQ1GfU1r/x oyB4OKs0Tk3Ca3gJ5QGLw/VvaMUiOVQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704297651; 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; bh=kntl/nAgkMTrS0b6uVdfD+vMpj63I1IJoYMsR9G9+XQ=; b=c5ROwIKR+mkPZYKoLpZaVzT7SC2ZWpnMYPuCCYc5kZ2A8COxQcjI6eXbzXntXkXVkUMBdg sGpFhep87oGobP6tP5KjpN5jNlELcmUIKtFfvsyBV6K1DxF0+PwSx/rVYW10gwSn5sKRIq Az0x0IjFvcy43KTGjksTJI6kvPvv23E= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-475-7ixQZtJMP_e9IN75F2EF8A-1; Wed, 03 Jan 2024 11:00:49 -0500 X-MC-Unique: 7ixQZtJMP_e9IN75F2EF8A-1 Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-28c5c622a3cso4118811a91.0 for ; Wed, 03 Jan 2024 08:00:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704297647; x=1704902447; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kntl/nAgkMTrS0b6uVdfD+vMpj63I1IJoYMsR9G9+XQ=; b=gTebvZTSzVRD/8VnNxrR9hZcv0k5sZQdqpj/PJiPuK5YSCJslAPY6OhNGyGEx9dBRe gX5+m8g0wsVQ0qtVK2sQINHaVTPnHu05Yu5Dw7ZCx/P7yCSLCB8SaUWaetPL3UuvveII cI5mxUTZyFfHvlbmMTYtSMvWq5EGrV9mr9EVzGeNq7hUcUM+9gWCN6LP2RzMjQFdwaqU SEKkGROitWh2rl7wRr2U3AeFBQSiOkt0OlLuo/QR3lHrPVhFFWPIA9l/3Arz+opQ1ijs LFD/3PKZrwucWYTBr2eCmOMNvTJ6+NuYWSBv5iMfu2Qjxg1twCcdGyBz5Sy5UcapDyoW 4n7g== X-Gm-Message-State: AOJu0YxEjmg9gXcikm8eDdzeF4MyxGEwPmi/3vEerufgVGA6FbiKncq6 uqCPiV9sro7G9AO/O2MALddu4aM7A4tXNVw+nQR/QYi8TyZnFrnoaCbRboNCxWSa406njNvAqXF WGt9i1n8jnI1vFU6fZTdCstXKJmc= X-Received: by 2002:a17:90a:8904:b0:28a:cbce:71ab with SMTP id u4-20020a17090a890400b0028acbce71abmr6468994pjn.13.1704297647439; Wed, 03 Jan 2024 08:00:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEt/3y+tufgltM/XFXS9WiJx4E8Mcef48BephLcAK7LUU4REFf4sxMOI/5885O5oAW116hzaw== X-Received: by 2002:a17:90a:8904:b0:28a:cbce:71ab with SMTP id u4-20020a17090a890400b0028acbce71abmr6468965pjn.13.1704297647085; Wed, 03 Jan 2024 08:00:47 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ec:911:6911:ca60:846:eb46]) by smtp.gmail.com with ESMTPSA id qc8-20020a17090b288800b0028b1fce7c01sm1922253pjb.37.2024.01.03.08.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 08:00:46 -0800 (PST) From: Leonardo Bras To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Eric Biederman , Kees Cook , Oleg Nesterov , Leonardo Bras , Guo Ren , Andy Chiu , Conor Dooley , Xiao Wang , Vincent Chen , Charlie Jenkins , Greg Ungerer , Andrew Morton , Kemeng Shi , Alexandre Ghiti , David Hildenbrand , "Matthew Wilcox (Oracle)" , Qinglin Pan , Greentime Hu , Baoquan He , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v1 0/5] riscv: Introduce compat-mode helpers & improve arch_get_mmap_end() Date: Wed, 3 Jan 2024 13:00:18 -0300 Message-ID: <20240103160024.70305-2-leobras@redhat.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspam-User: X-Stat-Signature: 5de3ayoqrg9zhojgyubuhth3yuuk7nkz X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 28CFD8001B X-HE-Tag: 1704297651-806705 X-HE-Meta: U2FsdGVkX180b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A5VamveT/Z1YpFOpkr2ybqHbYhUIhumSlaTAtTH108xpFxyfEHJluABpE8WxrbGcohU6gTEG7w7+6PktogHMcWa+lotxl4+/MCGtp05/1Njss0AtIV9IFOsSq/tQrRJ2ZVy0qvzMKXQ44HdJnQFqjsmiQxeRs1Q37nwoOActuiF/QRHPMhCMhrYyOJ9JOAh3NA00FsRgzqQKKgHuwweAC0FcK+L8822KXPerbqFcBujKD0cthAplLJrYIpFUnbSNNiw/+/Il6u2XEKvFeKzo4uS6h4T1381w5Ogcr6d1bHMTOXEfmp5QBzhQZoaouK+qSDWLzqF2za3CEZlFn17H3cGIGGyeNoE8zpzPvet2+QtUUT98= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: I just saw the opportunity of optimizing the helper is_compat_task() by introducing a compile-time test, and it made possible to remove some #ifdef's without any loss of performance. I also saw the possibility of removing the direct check of task flags from general code, and concentrated it in asm/compat.h by creating a few more helpers, which in the end helped optimize code. arch_get_mmap_end() just got a simple improvement and some extra docs. Changes since RFC: - Fused with other patchset: Improve arch_get_mmap_end() macro - Renamed from "Introduce & Optimize compat-mode helpers" Leonardo Bras (5): riscv: Improve arch_get_mmap_end() macro riscv: Replace direct thread flag check with is_compat_task() riscv: add compile-time test into is_compat_task() riscv: Introduce is_compat_thread() into compat.h riscv: Introduce set_compat_task() in asm/compat.h arch/riscv/include/asm/compat.h | 19 +++++++++++++++++++ arch/riscv/include/asm/elf.h | 11 ++--------- arch/riscv/include/asm/pgtable.h | 8 +------- arch/riscv/include/asm/processor.h | 16 +++++++++++----- arch/riscv/kernel/ptrace.c | 6 +++--- 5 files changed, 36 insertions(+), 24 deletions(-) base-commit: 610a9b8f49fbcf1100716370d3b5f6f884a2835a