Message ID | 20240130-use_mmap_hint_address-v2-0-f34ebfd33053@rivosinc.com (mailing list archive) |
---|---|
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 4BEFDC46CD2 for <linux-mm@archiver.kernel.org>; Tue, 30 Jan 2024 19:04:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C95B6B0099; Tue, 30 Jan 2024 14:04:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 877DA6B009A; Tue, 30 Jan 2024 14:04:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 719D06B009D; Tue, 30 Jan 2024 14:04:36 -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 5DB9E6B0099 for <linux-mm@kvack.org>; Tue, 30 Jan 2024 14:04:36 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 271441A04E5 for <linux-mm@kvack.org>; Tue, 30 Jan 2024 19:04:36 +0000 (UTC) X-FDA: 81736903752.08.4B4685D Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf18.hostedemail.com (Postfix) with ESMTP id DF53A1C001D for <linux-mm@kvack.org>; Tue, 30 Jan 2024 19:04:33 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="wRfwoA/n"; spf=pass (imf18.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=charlie@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706641474; 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=4D44QK/kPW88RwduNoGSI0iqhkYRS1kC786c0l3XOWc=; b=RXM0UtA5rZ10fTvCHoD16M9oVr+dR62bsASQmvQldOtTHuqsiHI4Okee8stAal37FFnmba p4WXuleCfrUrzyGt2KYIWd5b22v5iUTQzYSxHaT2hD31V5HXRq8uaFZkVj0mb4MC0BDc9P xiSA2H5QLIKad6Fn4nOPBrfgt4Axs2A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706641474; a=rsa-sha256; cv=none; b=Y/h5lDt3ARagH2tIXPOKNtG4V9bQzikltKI5DHA63KjfcSfJlUPuLCGgAM6M/e+c5zGN9W 8CkCeN/znGwROa5SNFy6wi6SNKcSuOPNpxmtvOR4zAmGrYWhujV/3Mx+9R8wIy8PqbAKG4 GtFl3FmJ1HE410gKeVFytoBOiskraVA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="wRfwoA/n"; spf=pass (imf18.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=charlie@rivosinc.com; dmarc=none Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-5d8b519e438so2134982a12.1 for <linux-mm@kvack.org>; Tue, 30 Jan 2024 11:04:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706641472; x=1707246272; darn=kvack.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=4D44QK/kPW88RwduNoGSI0iqhkYRS1kC786c0l3XOWc=; b=wRfwoA/nNEv3NGxluUVtK2GCUhfQbvg1QqtZmnYcxopWREw7RN7PikFrKGeYLyKNUB ufzmjm0mwYloS9JthCURYJv+Oo0Hq6zSBGpx58qkS+BoSOljQAYFnWD0BwqvCo8u3bt0 a65U+ByPeXMOAm0MVlE4DwbcWvifsX3c1MlwSXHnGEHygV77ND+qgd+bLMEy2Pkk6fd7 2KCFW2x4xUHJTbYUzShSqFh5dRkzk/TMxrEQC1Xh+6pFJRPHDdQ3bhrEinoy8RQM2sbS vH8DGwCLVZj97Q6eUT5zzRrxE6woPv+6wJWdYL3zS/N/iexCLMzEw8iuMQ34dHs2NtMf S5ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706641472; x=1707246272; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4D44QK/kPW88RwduNoGSI0iqhkYRS1kC786c0l3XOWc=; b=HWZK2+gamYImFscGx/+a3+1lVfXlnLOZnVYRaI/pIQEISat3JuEpNQUhTxD0AOR1om wVGCJFJTe8gs0TJU3azM2tfT/Q2gBEtCmO8q05HLqmckkLgmhj1ZOqMqdHyRMz9VcYox KDmLe5mNQm3bcb/0cxt88YIUM7xhLjPB3DSefjvetHn3BIyNO7rj+AqE/UxDxZrWwBz2 qnmG3SpRT49Rp71DWkjZEtojMkG6L+rEIKDfFlc7k+kuYt1g6T9FP3mgzXVzRWkT/svY hS5+PRW3gvO4sJmJb0Gycu/Qgwc3Nr89oSBrRW0dzfzHGMUZnWvSnBvNK7671n9e2s8h jkPQ== X-Gm-Message-State: AOJu0YyRHg3p8Ptmjz9dgFMs0i8lDw7n7uxOSy9ZDYnC4S2IAN7AfkM/ ZrM1EYRpTRdU6TDDaktsXs17d9gALkAkKOTyVAj5EeXMcmXL3WHYrnX9WYh/Y9QOGGNTAXczIQx f X-Google-Smtp-Source: AGHT+IHDqzd/dBdeKM2ZuEG20ibf2MrAQHh0T7+zovFIc6n7MNP/9tMbddtfCfApaIPGdcPdBlRWvQ== X-Received: by 2002:a05:6a20:291e:b0:199:8ed6:746e with SMTP id t30-20020a056a20291e00b001998ed6746emr4930207pzf.58.1706641472640; Tue, 30 Jan 2024 11:04:32 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id f6-20020a17090aec8600b00295c3bb9318sm1196541pjy.54.2024.01.30.11.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 11:04:31 -0800 (PST) From: Charlie Jenkins <charlie@rivosinc.com> Subject: [PATCH v2 0/3] riscv: mm: Use hint address in mmap if available Date: Tue, 30 Jan 2024 11:04:29 -0800 Message-Id: <20240130-use_mmap_hint_address-v2-0-f34ebfd33053@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAD1IuWUC/3XNQQ6CMBCF4auQrq1hagXrynsYQtoylVnQkhaJh nB3gbBxwfKfZL43sYSRMLF7NrGIIyUKfglxyphttX8hp2ZpJnIhcwDF3wnrrtN93ZIfat00EVP iTjlpwBTu6oAtv31ER5/NfVZLt5SGEL/bzAjrdReFOBBH4MCLwhq8lU6qAh+RxpDI27MN3bqxA +oYyLm0pWz0DS5Gwz9QzfP8AxGwGU3+AAAA To: Alexandre Ghiti <alexghiti@rivosinc.com>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Shuah Khan <shuah@kernel.org>, Jonathan Corbet <corbet@lwn.net>, Yangyu Chen <cyy@cyyself.name> Cc: linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Charlie Jenkins <charlie@rivosinc.com> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706641471; l=2052; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=nus7scvl4gLMAQ9st9lYJlzmjXyvjRvTvEos3E8SaN8=; b=KdPbSOIofsdWCW2zc9sZLA78Ps5RefDdeL5SX6tbIQDoFBXQBMlLBYRg9jpjXuHz+YesaWxjJ OSV+nMMkghNBtK/mt4vwjxEe5eas0TqtgvuALwBT9CPyCLon78uuHuz X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= X-Rspamd-Queue-Id: DF53A1C001D X-Rspam-User: X-Stat-Signature: qnqicxz5wqmzob74okw86rge6te6w5mt X-Rspamd-Server: rspam03 X-HE-Tag: 1706641473-665431 X-HE-Meta: U2FsdGVkX185s5M/peQ1MZaBeHO7jObASEwe6m211YmG48JZpqBPDgooEiPGfy/G3PEd3VoXbIwstzPQiquaOiT5Qc4M3b5JUc0YRYDqJrPmuLnMy4uoVzKKCbZNkCN5+w419Qdk4yPwkkrDXHPxBiYTf32oppRxCHl48ZgEXs8VNlABD3UzmWu4jGwRa6mMLYgcMeYT+CNopGbVB+1M2FE7Nctg1Jz8znDZIEefAWQziRGBRVXgjfjj1sWdvcREXqWfeI7yN8T5/gCh8TV+EEHeU8Ysblv/zcD1gG7eqbPxbJYdpnV6Q+b6QwAlmsJ1fzxOoYsypzXx9vR4wH0qNtWLA9UeoDcSC/M4Mo2B3yWo/gmEsHK2wFohbBwCN22yM97kjyr0hswuMoNks/pdUnx/sPeaj/DL8/s+SRY3TV83jtV2+FXjxT6RQ5eX9D/PYre6xpysQtyhE3i8c0WUPcFe6BBSvmMSeDd/F1+290Lhze1dRYaxsCulALw43kX0DitlCN/bM0ydJT8qajtYnqnn8BzMLZu+AH7S/mFvtY91v/F2jpkQ3T7+8rbb6t1z8B4pvAByvUlu1vpM29iBxl7HkdMJDQoC0slNhu4VSmEolXsL7/8+OW6dfl2Ao7T4/nnEqq+eNlxFz/NVsp5n5WE+g/kPBq6Qx8dyrTbj4oYYkkjsjMB1m1YpW4FRX0tZPo3gjrWO4SKxiyiXgtWhn031xZeHMuSuAft3iS2NdFtw2Wg7Ozp6Y3Zd0PPAc5lHfuiljDPhW99H+d7CxbmxlQM+iTOQEDoVFZHTtBrcT7CvEMOIQMHo4f6n+S7sNF7d0D01tYrwryZVn83deMNUmE8ltNuxI8r+TtPXi5lAMJ8NG8wJo7BH/CLgCRBP5e66fFODbvtlQKVM3g8qc3/KOvOtDIA3oPmWqYzRuwz0JMx3VQUupwRvtcT8DvXiiHAC+Se/gguEE7ExDGjwMYR 0fKIo92F d7WvieZss3e8ZaQzspJqYR5AeVFbe67v+Moj4n+4yGLeRr1TAhfSjN10Pt0O/B0UklyqUFDSMwDw8c/4woSmxN1MaozssfJ5s9J2dkw19fkuWq27DAT0fIEiUm6Ew0k8bWURZyBxgU2OH0ETs8sq6o4bf51Ve2irGJkm+dLUndo4/DZe89W/8O0La7aZ3oXiE0+t+2SkNv6Sm3hqlWllni+2zFzL3fSJoJThTeshtOjkhXXiWGTZJWPOTkOxzJ3Z4oIFNxpDf8QvfcayC8MXh1vfiqhOs5O83XeOng99hcgWew3qsqSCEQwoZ9Wg7g87lBc9nsm+74UKg8DevAYQ3taXbhOVZH9yDNptqLRBBLpxcyAESUVISamqYY31IaQx0fDTOB/RQ+uCH72Qop2PFOC8OvOkNWbNN5i5l7zi9mUpCPQJ/3TR0OZYzVre9XcbNv5VM9WUJTKffKQ8NXZBGZ6lUKFTaosF6hrMLkPYMB2vyYuoAZhk3Boz6eqrE+ny5i8+n5qQjfig/pTg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.037726, 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 |
riscv: mm: Use hint address in mmap if available
|
expand
|
Hello: This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <palmer@rivosinc.com>: On Tue, 30 Jan 2024 11:04:29 -0800 you wrote: > On riscv, mmap currently returns an address from the largest address > space that can fit entirely inside of the hint address. This makes it > such that the hint address is almost never returned. This patch raises > the mappable area up to and including the hint address. This allows mmap > to often return the hint address, which allows a performance improvement > over searching for a valid address as well as making the behavior more > similar to other architectures. > > [...] Here is the summary with links: - [v2,1/3] riscv: mm: Use hint address in mmap if available (no matching commit) - [v2,2/3] selftests: riscv: Generalize mm selftests (no matching commit) - [v2,3/3] docs: riscv: Define behavior of mmap https://git.kernel.org/riscv/c/371a3c2055db You are awesome, thank you!
On riscv, mmap currently returns an address from the largest address space that can fit entirely inside of the hint address. This makes it such that the hint address is almost never returned. This patch raises the mappable area up to and including the hint address. This allows mmap to often return the hint address, which allows a performance improvement over searching for a valid address as well as making the behavior more similar to other architectures. Note that a previous patch introduced stronger semantics compared to other architectures for riscv mmap. On riscv, mmap will not use bits in the upper bits of the virtual address depending on the hint address. On other architectures, a random address is returned in the address space requested. On all architectures the hint address will be returned if it is available. This allows riscv applications to configure how many bits in the virtual address should be left empty. This has the two benefits of being able to request address spaces that are smaller than the default and doesn't require the application to know the page table layout of riscv. Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> --- Changes in v2: - Add back forgotten "mmap_end = STACK_TOP_MAX" - Link to v1: https://lore.kernel.org/r/20240129-use_mmap_hint_address-v1-0-4c74da813ba1@rivosinc.com --- Charlie Jenkins (3): riscv: mm: Use hint address in mmap if available selftests: riscv: Generalize mm selftests docs: riscv: Define behavior of mmap Documentation/arch/riscv/vm-layout.rst | 16 ++-- arch/riscv/include/asm/processor.h | 22 +++--- tools/testing/selftests/riscv/mm/mmap_bottomup.c | 20 +---- tools/testing/selftests/riscv/mm/mmap_default.c | 20 +---- tools/testing/selftests/riscv/mm/mmap_test.h | 93 +++++++++++++----------- 5 files changed, 67 insertions(+), 104 deletions(-) --- base-commit: 556e2d17cae620d549c5474b1ece053430cd50bc change-id: 20240119-use_mmap_hint_address-f9f4b1b6f5f1