From patchwork Tue Dec 10 02:41:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 13900706 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 EE3C1E7717D for ; Tue, 10 Dec 2024 02:41:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 635196B00F2; Mon, 9 Dec 2024 21:41:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BF486B00F4; Mon, 9 Dec 2024 21:41:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EC706B00F5; Mon, 9 Dec 2024 21:41:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 17C0A6B00F2 for ; Mon, 9 Dec 2024 21:41:38 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 941581A023E for ; Tue, 10 Dec 2024 02:41:37 +0000 (UTC) X-FDA: 82877497962.30.B586EA3 Received: from mail-oo1-f74.google.com (mail-oo1-f74.google.com [209.85.161.74]) by imf10.hostedemail.com (Postfix) with ESMTP id 83928C000A for ; Tue, 10 Dec 2024 02:41:26 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=C1FR8tmj; spf=pass (imf10.hostedemail.com: domain of 3XqpXZwsKCFM5v6zD2D381219916z.x97638FI-775Gvx5.9C1@flex--kaleshsingh.bounces.google.com designates 209.85.161.74 as permitted sender) smtp.mailfrom=3XqpXZwsKCFM5v6zD2D381219916z.x97638FI-775Gvx5.9C1@flex--kaleshsingh.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733798475; a=rsa-sha256; cv=none; b=B5RqHsG/e71h7knZ4wtCXUv/vkjDEE2bfiiGQhL7w5syC+wT5bbOtmm64K4XfeC6bjGkw3 8NY2k8WpHSeW0NmEfEzyeJooduzweu44gQTDBfgxSg5ZdzYnlhm1oz50lDAZlL6D0aQ0MG +q9tZbPHpuOcbKYDPAqJh4yeqfvVPUw= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=C1FR8tmj; spf=pass (imf10.hostedemail.com: domain of 3XqpXZwsKCFM5v6zD2D381219916z.x97638FI-775Gvx5.9C1@flex--kaleshsingh.bounces.google.com designates 209.85.161.74 as permitted sender) smtp.mailfrom=3XqpXZwsKCFM5v6zD2D381219916z.x97638FI-775Gvx5.9C1@flex--kaleshsingh.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733798475; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=10lySyzZTVvC+S5oM1O6pINxMohBlWGSJurdKiLL+/8=; b=eDoByV6q3QrQvDoOa7Xhiu9H2mG+QRn4XEzucE1eXXqiFvtK6JP2x9GLoJqI0gP5G/089H NxmHawVZRdmu5EFAQD5X2Au9QEpAO9y/+4GAH9O8SVBiPKTu8XhuYcNmg4TmgsYMsdYPls PTH6rc6yy7dUiM3PAJl89AK9e2FXi7s= Received: by mail-oo1-f74.google.com with SMTP id 006d021491bc7-5f29eb1c357so1575986eaf.3 for ; Mon, 09 Dec 2024 18:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1733798495; x=1734403295; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=10lySyzZTVvC+S5oM1O6pINxMohBlWGSJurdKiLL+/8=; b=C1FR8tmjGjljD0VKOfxnRKoAKb0TedSQcmdl0wU47VQbXih8WFSqlDLtmwpOcs/q89 Guuim4y/uZC40VoRSds8a2gtvOsUygsh4j+sH2yIl/TInaIruMQu1kc8WZZpndcPU8kT TRuyvlDS9FnCe00yOH9oAe6zZ6nCbq5zQbXT7dw/Hc1QDHXKMJxoFkexm9nhMcOzAnXY jIqUftE2GB/Wrn55sZTkO1UUk5MrwXo+2oRdkuCCXeRfsQTC2HOohtjEBz2yeVZOLm5p fDG+PKgYrk3e06IWkEE+KghXCNfC9h03sifTTOOJNrtyzUTULGhqqd6UpxtxHeV3b2uv oiYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733798495; x=1734403295; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=10lySyzZTVvC+S5oM1O6pINxMohBlWGSJurdKiLL+/8=; b=MTIMTnk5VBOtWUj2F1Nt5FpIj6VwITe4CZUD+F6jH6OD3RcP2Y6n+EGHRTD23OnNOH yLn2ali9jm75BI51pD0pGSwXRvlPNc7QxFkuVNJDoE6UfaCQUbzVZR6UF+67M/E9OIfW zcPBZIelo2p83z0OQsq6ezYBzigLLl7ESgdcOraKJzUO9LfWtVYHPXS3hXc5Ejz8f9o9 vtcyyidYiUXbdG9+PzlvMrbuyFn6vTsPd7fUHwUwIYP6kR+FCnyCMGFSURAMtZZH1OSw 8T0lJsg8H46U+1FKLZBt+FuFs19ivrGfITGZnL3PVXllXHtf1SKb/LUsZhmjGY2j7XgV ACgA== X-Forwarded-Encrypted: i=1; AJvYcCXwYDlF9KTX/Q551qy/RXkzxIKvZV2FDdsLBjRGyQfq7ACno/0M6ha53vR6ACn+LO14yM/ict/+tw==@kvack.org X-Gm-Message-State: AOJu0YwLLeqT6n0+TrrCSg1fNkUhcc0CyCtMiJRyLk6klok6PLDrr7SS jFlgfRaeI82OXXqsi0aQCnByR8TBTSC4hKca4r/BPuncnakPOT1GwBdjB+7qGok6SLbD9fVmgVe facExcspPJIe/oY8GshbQCg== X-Google-Smtp-Source: AGHT+IGrVCmYvgbRZyJY6d84f+llUxgBN0sslSfR3tN174qad1011sAwn0+s/lhjeAWOT5E3i4gR4UE5Ru9TVnP2PA== X-Received: from oabfu21.prod.google.com ([2002:a05:6870:5d95:b0:29d:c6f7:1bb2]) (user=kaleshsingh job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6870:5a9c:b0:29f:f4af:dc34 with SMTP id 586e51a60fabf-29ff4b0889emr667703fac.7.1733798494636; Mon, 09 Dec 2024 18:41:34 -0800 (PST) Date: Mon, 9 Dec 2024 18:41:08 -0800 In-Reply-To: <20241210024119.2488608-1-kaleshsingh@google.com> Mime-Version: 1.0 References: <20241210024119.2488608-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241210024119.2488608-7-kaleshsingh@google.com> Subject: [PATCH mm-unstable 06/17] mm: csky: Introduce arch_mmap_hint() From: Kalesh Singh To: akpm@linux-foundation.org, vbabka@suse.cz, yang@os.amperecomputing.com, riel@surriel.com, david@redhat.com Cc: linux@armlinux.org.uk, tsbogend@alpha.franken.de, James.Bottomley@HansenPartnership.com, ysato@users.sourceforge.jp, dalias@libc.org, glaubitz@physik.fu-berlin.de, davem@davemloft.net, andreas@gaisler.com, tglx@linutronix.de, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, chris@zankel.net, jcmvbkbc@gmail.com, bhelgaas@google.com, jason.andryuk@amd.com, leitao@debian.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, kernel-team@android.com, android-mm@google.com, Kalesh Singh X-Rspamd-Queue-Id: 83928C000A X-Stat-Signature: xkk4eew34pt1n5nk7kd44sqziggsf99y X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1733798486-79596 X-HE-Meta: U2FsdGVkX1/I/nyPFgPgfHCKIDBnM3Bb9FABvlzMKiQO9m3BplMksTr59NYPCG11fU42Hf5ydbRn6eAxvVuV6nLcseeqva3/RuujyJ6Eud0LiaMDz9/sDdmsXIjrGzZWB1zQjNkYw2G3Eno3CxjzONyX0T8+oHGvZkloQwXl1ZBmymBFOTHzCadxJM8AaD2LZulJBQcOsmCvcKRJY6avr7zja9N1cIeCB5ehjMaIqn2UDpihBg4/SQOhjDuHJz4DCNLcPEGpsQIMpr13iKMXnPJmE/Dc5LXvvPtu5TJu26FHqWYJ2/BGlc8zRO4hTUauWeHUtNYxhtJepQEhpFjzvfzSl4qD3BxNJ9QOH1ZShMWeyDlWkfOlEP8XNrAnwhnnfvoM0Rg7C+YOiauWvuo0FmZQIGwbz+vqxWVfGYg/7UzwUuiTgT0lr7/P/ktI/iueTJx3mUZTiQqRCHwyHotkZiyeMdVTzWGBI/P7W7hT5XYfdZYOUFys2y9SFJ2CMVKtZgluhZiCYtozBaay2cphupciN98z7yIwGdsjiwFWXSlzreKk8oj1E58hO3pCge0d5iF5IQG+IkcNknaKJmJynIN24FsUPBbYroSOtJgCdg+7ka2qHDITDtTd4MAhUSXVUuRSHq2PCbHpzUajXzlN+x5DqKC5qJ5F9/BlwYIGfhYZx6K2QutZ+GNraJ61GxQTZHn9mws61GuSBJkWY7jZvzNeOvttJW/R4bZxauwkmayEVmpVmF1+AHKg6OquJvwxHybAHUb9vsb2LkUpMXyaQTECv4AyHRWBu96KhviL9cXBYayAKd6znjJTkxXgW14P2d+DzGaXIqhqTxz65GxWTraOFIU4v/AyUMnam1pLggXVL+BMx1YkEDaqN1lNBKG+NKzhdnTijVG+mV5iMeA0HJ6ZByxoN+ATfLkGoYYE5k1DN+NoVDjuqrEcmnoHD/R4PNk5jsqavc2NOeFKzRJ Bfr/1lwu OeNFkWlIIBJhoyDhaXQ2aNRF3Uk46TNCgxDwQ+EK5tlTiDtqXSGuEGFyNuzkSVyzvfD3u35EeyV67/svNj+4bmxqEY1lqQPlR4xKuQsv3ORMeF/H3QNd7MsoL1moAmqjqjciIfJFWghfHjWK5pN1I+0EstzatOLRzaMkF4Y6czH6fe5J8B9j7S4l0XOtjRLGp16bMVcFz4XiS1JTJBZ9sBXySUPSSwVXnZAGn1/SwPJXzsa/+O5F3oleUcItXkyBiyHweJKqSdb+PRvPJfTuqHsdJrig9PjAP7ZNv+LJyOMQSJv59lPPSimXtvEmFE1CRFCLRhb6ikqjk4OygM9KBt+EzI6oUJyGW5QW/fZmw6ocHHyYCbsSyHsm/4kHgYrdWnzLDNC1EktX3ulp33sjwqv+Pp6UtZahO8DwA6xG4weMRXOr694lJZADn3SLSSBjiGuMfsCyY6zaxs2FQ/Ehlrk6w/WYPPT8lF+OJ0yf9Y9gGSUaZQ433/QB+JVoPjoVHDq+Qb+lBkW2fEtI2fpUHMXYkNQwr5ivx5o9IKKSKFVDZpO14QXacXBjoKaH2/wxOeBmtkV9Ru5+txl5D4vvG8ckuFGJk9huPJ2oRP3eOoYnWdmH4JU/BDDLC9xJ60s6WAy9g X-Bogosity: Ham, tests=bogofilter, spamicity=0.165962, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Introduce csky arch_mmap_hint() and define HAVE_ARCH_MMAP_HINT. This is a preparatory patch, no functional change is introduced. Signed-off-by: Kalesh Singh --- arch/csky/abiv1/inc/abi/pgtable-bits.h | 1 + arch/csky/abiv1/mmap.c | 38 ++++++++++++++++++-------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/arch/csky/abiv1/inc/abi/pgtable-bits.h b/arch/csky/abiv1/inc/abi/pgtable-bits.h index ae7a2f76dd42..c346a9fcb522 100644 --- a/arch/csky/abiv1/inc/abi/pgtable-bits.h +++ b/arch/csky/abiv1/inc/abi/pgtable-bits.h @@ -51,5 +51,6 @@ ((offset) << 10)}) #define HAVE_ARCH_UNMAPPED_AREA +#define HAVE_ARCH_MMAP_HINT #endif /* __ASM_CSKY_PGTABLE_BITS_H */ diff --git a/arch/csky/abiv1/mmap.c b/arch/csky/abiv1/mmap.c index 1047865e82a9..184921a73856 100644 --- a/arch/csky/abiv1/mmap.c +++ b/arch/csky/abiv1/mmap.c @@ -13,6 +13,29 @@ ((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \ (((pgoff)<mm; - struct vm_area_struct *vma; int do_align = 0; struct vm_unmapped_area_info info = { .length = len, @@ -55,17 +77,9 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, if (len > TASK_SIZE) return -ENOMEM; - if (addr) { - if (do_align) - addr = COLOUR_ALIGN(addr, pgoff); - else - addr = PAGE_ALIGN(addr); - - vma = find_vma(mm, addr); - if (TASK_SIZE - len >= addr && - (!vma || addr + len <= vm_start_gap(vma))) - return addr; - } + addr = arch_mmap_hint(filp, addr, len, pgoff, flags); + if (addr) + return addr; info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; return vm_unmapped_area(&info);