From patchwork Wed Dec 11 23:27:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalesh Singh X-Patchwork-Id: 13904384 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 1872FE77183 for ; Wed, 11 Dec 2024 23:28:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90C4A6B0083; Wed, 11 Dec 2024 18:28:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BC026B0088; Wed, 11 Dec 2024 18:28:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 783F56B0089; Wed, 11 Dec 2024 18:28:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5C3C26B0083 for ; Wed, 11 Dec 2024 18:28:01 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0F1361614E6 for ; Wed, 11 Dec 2024 23:28:01 +0000 (UTC) X-FDA: 82884267816.18.37CEBF2 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by imf09.hostedemail.com (Postfix) with ESMTP id 1A468140004 for ; Wed, 11 Dec 2024 23:27:42 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=yjSAlBD3; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of 3_R9aZwsKCOYSITMaPaQVOPOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--kaleshsingh.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=3_R9aZwsKCOYSITMaPaQVOPOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--kaleshsingh.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733959657; a=rsa-sha256; cv=none; b=itXDPQ/jXITQnjmy1IgYcGn+BdU02m+siv+60TcsSy/ve48eses7KsoljARYujKbnmK9nY WTrcMsSLVog2Y4FWwRGDEM5ojvEAd+MAS1M0ElPRL3OOjKL+WqVb3DcD1B+K6EKHEEjRzd s17rpHhfNgouheMzShFhp4aMtie3VE4= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=yjSAlBD3; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of 3_R9aZwsKCOYSITMaPaQVOPOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--kaleshsingh.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=3_R9aZwsKCOYSITMaPaQVOPOWWOTM.KWUTQVcf-UUSdIKS.WZO@flex--kaleshsingh.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733959657; 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: references:dkim-signature; bh=5Y13tezS9osfEyeZZhDu0hB4QwVrkWFM3vdAGWXDL0s=; b=gKZ4If0m3FYRJH1ABNE7yMRXT/YkoVfqpE7LFM+vI7BtKACaE95LVPv/5GiMM0PCmVjN8s uznqapH9gKKGOGzvq5icTOImrQ+XywdeJslejtln34G+pYr+aRVZpIjTaPdYFJnLSaTfQd 5k3pdbNSWe37pNs3b13lCXAafuPl7fE= Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-7fd3c241975so1025654a12.0 for ; Wed, 11 Dec 2024 15:27:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1733959678; x=1734564478; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=5Y13tezS9osfEyeZZhDu0hB4QwVrkWFM3vdAGWXDL0s=; b=yjSAlBD3ZGrGif9keiSToOC+xnU1AsesjccSPGfqWOR3cenouzlhYELjiLgOJtJ3yx W8BXVvCOPvKpXGhRLjYOtLO4NAhJ5axyqc0OPxBETBC+eiPm2B+kYvn2YyZB35nWgutC 9drXgM0zxF2JrH9Jh1Fctx7IzoFqKFOJnpJCW0xFYrZxCps8Jkl9uBVyzCV/A7jVSkhF ZnkSRq4wFFMRCghGcGXWiTwtX0bb7SQcC8P7Nf0x/hgSoriydm0/k6gRsmu8Fb5QBwPv Z8RP67u8hOcTXANPDeVfpQMj5S01p0x1KFzc+9Zm48x1qch9TReuCCb8zsiOyqrOWjA0 j/NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733959678; x=1734564478; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5Y13tezS9osfEyeZZhDu0hB4QwVrkWFM3vdAGWXDL0s=; b=hjghtAMAcZJPKBWTPjSd9oPsuXJR62OjiN/x9uk2w/kxtKed8f2/TkOKiDV3Ct5I4A 251NIpZRkHrGNHWDRFhjs64wGIZKFJwpaEqukbYJe6qRyfem3wNJuPnz4gWndC1t/we3 +JLe6RQnBAXJevCJktVdI+5Oq5Eq4hPfcJNNAqqFRKjsrJ3ZT4OOK3wkaLqtofG1eodX AmavJJQZI32xrdixhNstwngjiiPnhskgX70H/FOWLdl+ii9uIZiLQNuPJZLrGXRS+AdK xKZKFbh/U0B8zkOZ+gfvCUcps9bDZLF7M8QbgenepD6L2rHRuRJD6a0UbUyyVGHLk0oM Mr9Q== X-Forwarded-Encrypted: i=1; AJvYcCW5ZCVl76AmhElMQ5f8nXKHlQsypLlnNAqQ01yIi4MFUWlIobqRMRFRykqaixA8lQ+gn9h2HyzReA==@kvack.org X-Gm-Message-State: AOJu0YzSprZwVQJaoqS2xoUp0Lk1L3WmWr1zJ18PBNMaxtcCFSzA2oz5 815gt74eRUAtJzThCf4mladviUFkH+wblgevW1YEoToF7WP4so8r+4HDIqlH0w2+TsuaMKkh/uC fbSlecwohBCnqzpTsYAuwDQ== X-Google-Smtp-Source: AGHT+IH+hxwnbTejsd5rMe6ZdiiLsQVYXh76CpSNZ1O0EO7ZME4Z+uiov/c6u6U8sBeYTnWqfHb7LFZNMZjeMUedcw== X-Received: from pjj11.prod.google.com ([2002:a17:90b:554b:b0:2ef:9866:6155]) (user=kaleshsingh job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1f81:b0:2e2:c2b0:d03e with SMTP id 98e67ed59e1d1-2f13abc6e43mr1624666a91.5.1733959677870; Wed, 11 Dec 2024 15:27:57 -0800 (PST) Date: Wed, 11 Dec 2024 15:27:38 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Message-ID: <20241211232754.1583023-1-kaleshsingh@google.com> Subject: [PATCH mm-unstable v2 00/16] mm: 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, minchan@kernel.org, jyescas@google.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-Server: rspam04 X-Rspamd-Queue-Id: 1A468140004 X-Stat-Signature: u1girtjhjwnpdtquxmf173hj7kwbnxd9 X-Rspam-User: X-HE-Tag: 1733959662-666338 X-HE-Meta: U2FsdGVkX18G0vnY8wc8l4xxScRkKVESfiV5Cf/kgpHeQTE+f0ZN/mXBwqAM41ZChzUs4djp15fMvZh7GuKnGZ3gIKJ4/9EfReY+ywLYwHTvFQtHB905wDt/Vvmr6Ptnj22XF7FWfYyGFe00b40wvt3/qoMoxE1+aTOlvkOnZCvytqpgATW5AVlBk0GU3c9Uut7qVfEfSywOJ/rIgigyj/8G/m2y1LCpb26K79hjurjmToIoK2P5u6UrMYAwgZvaZ0k8kvQJPA/MEawa5hVRoqfaNTSlMRIjpGC0g8pwqSMWxejN6Xeq9iflvxaG0XtHv+mrc8l8xyXIFpzlneMgkvS7CI8L+fgCB+FB62vxhyQkTTPa0TK7qiyXKgLE3G/5QnxbqnwXhplgoeCKSAd8qEfsG4FxVf9BwfIg21ZgVYckaMAe4RKHsAYU1bOuIRPF9WIRX+1XtRnTRQgsoVz+escN0sd/H5hc76eTf2sfVoQN9K9g7wGRVpzWpTRaqIVZf9suAs2TQQMRGV+36dn/Dsf+6fkhjUjRkIMQr/mtS0YtbZWL8/hV8ILRSjzip5klzf7fkEo6SKDwuPiPxQ0Dr/tioEybkDe+mHEdA/rrVutRvkb75ZEaZzUC+o3gRZJuDXQDrRxFSUwYj+FoHmGwKdAigLrmKUIxJDkanKK/WzAUNY/mztCdjAvFblZ6WNtlL/gIxB/bMz3tPuK8swqr7QraT5cXgL6JRIMLpkN4nPlkYTHAMMh3ndPHbV4r+zFtmbQZjH58VDsJ/F4ws80TqaAHXxp/V9/+JqWCZ6htNt0q9FLwX7Gk/GC90qJSa2s5BKuSfHvssL/mN2FUS1NPGNuIcj/ciKrq+nTSPlDlGjC+pJgEiWzdm9PLl8xZ3HZdl2ojO5Vp67k1nOqOltV13eWRxbsdmV30rgfjAVtPprD8V20AZ2QqUGTYyT+Z5xK6RkTmBrr7At1D/+hQ5zy 9QtJ0cgG lUL7rm+JuHgKxpJL+M878zr4sEzo53OxEnOyGjqfiSsogHjdj+aYJ+lenPYYOpyBH7w5fRLmnOkRL2GgG5EOlUPOqM4DpyLGLFJt6bO3INGq9572R/bMBa04rMIqdrOn2miokfoddMaAF4OZhmRu6D86W0fh+5p5aKieMTEcAMTi7uGTF3hTwLks/T0JnCFobk6M/GK+IC0lnnMNnirkRl8zO4hJtxG3mWQc7LkJC0AODpGF9nkVEkk7nuysbMO55t71G0iSpRjBGE7BM+txpCJrFEQxezPHNPiPlfbWcE1FTIYhfYjvAMQu2FXOB3ydQHMQf86NcDN257WIMYPsx7Zr1OTr9xg6cSyRRzvOAiiNx0rzvnQG8aIL3CYCXL+/b199vVZSkELeVlsqGyzZ3cjVIcKNyGS3Hx9agLgdoEsUi0hRZqYaMhYYPpQBWSwqgJyCyet2LidWx7MQC1n7uBPY1veFLzYAOyqz/l/vqV+QhwkU7nOTr2UHr7bQ1W43B0nGo4T1/JnyrJGdgjM/2fhIYhLLq6MClWA3ADPT1uvgs1+Ugbmr2W55J+M2V3o8v9Y6Xr8cteSSUMcMhKT2LMpepGacXVAsR2eQdxPeKxMKj5aXMRnc54MmdfORBLk3mS+AuO5NAnoElnuP7BaDMubM/YA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.272316, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi all, This is v2 othe the arch_mmap_hint() series. Changes in v2: - MAP_FIXED case is also handled in arch_mmap_hint() since this is just a special case of the hint addr being "enforced", per Yang Shi. - Consolidate most of the error handling in arch_mmap_hint(). - Patch 16 ("mm: Fallback to generic_mmap_hint()") was folded into Patch 2 ("mm: x86: Introduce arch_mmap_hint()") v1: https://lore.kernel.org/r/20241210024119.2488608-1-kaleshsingh@google.com/ ======= This series introduces arch_mmap_hint() to handle allocating VA space for the hint address. Patches 1-16 introduce this new helper and Patch 17 uses it to fix the issue of mmap hint being ignored in some cases due to THP alignment [1] [1] https://lore.kernel.org/r/20241118214650.3667577-1-kaleshsingh@google.com/ Thanks, Kalesh Kalesh Singh (16): mm: Introduce generic_mmap_hint() mm: x86: Introduce arch_mmap_hint() mm: arm: Introduce arch_mmap_hint() mm: alpha: Introduce arch_mmap_hint() mm: arc: Use generic_mmap_hint() mm: csky: Introduce arch_mmap_hint() mm: loongarch: Introduce arch_mmap_hint() mm: mips: Introduce arch_align_mmap_hint() mm: parisc: Introduce arch_align_mmap_hint() mm: s390: Use generic_mmap_hint() mm: sh: Introduce arch_mmap_hint() mm: sparc32: Introduce arch_mmap_hint() mm: sparc64: Introduce arch_mmap_hint() mm: xtensa: Introduce arch_mmap_hint() mm: powerpc: Introduce arch_mmap_hint() mm: Respect mmap hint before THP alignment if allocation is possible arch/alpha/include/asm/pgtable.h | 1 + arch/alpha/kernel/osf_sys.c | 31 +++--- arch/arc/include/asm/pgtable.h | 1 + arch/arc/mm/mmap.c | 43 +++++---- arch/arm/include/asm/pgtable.h | 1 + arch/arm/mm/mmap.c | 107 +++++++++------------ arch/csky/abiv1/inc/abi/pgtable-bits.h | 1 + arch/csky/abiv1/mmap.c | 68 +++++++------ arch/loongarch/include/asm/pgtable.h | 1 + arch/loongarch/mm/mmap.c | 49 +++++----- arch/mips/include/asm/pgtable.h | 1 + arch/mips/mm/mmap.c | 50 +++++----- arch/parisc/include/asm/pgtable.h | 1 + arch/parisc/kernel/sys_parisc.c | 53 +++++----- arch/powerpc/include/asm/book3s/64/slice.h | 1 + arch/powerpc/mm/book3s64/slice.c | 31 ++++++ arch/s390/include/asm/pgtable.h | 1 + arch/s390/mm/mmap.c | 51 +++++----- arch/sh/include/asm/pgtable.h | 1 + arch/sh/mm/mmap.c | 83 ++++++---------- arch/sparc/include/asm/pgtable_32.h | 1 + arch/sparc/include/asm/pgtable_64.h | 1 + arch/sparc/kernel/sys_sparc_32.c | 33 ++++--- arch/sparc/kernel/sys_sparc_64.c | 96 +++++++----------- arch/x86/include/asm/pgtable_64.h | 1 + arch/x86/kernel/sys_x86_64.c | 64 ++++++------ arch/xtensa/kernel/syscall.c | 31 ++++-- include/linux/sched/mm.h | 9 ++ mm/huge_memory.c | 17 ++-- mm/mmap.c | 86 +++++++++++------ 30 files changed, 491 insertions(+), 424 deletions(-)