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: 13904437 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32171E77182 for ; Wed, 11 Dec 2024 23:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To:From: Subject:Message-ID:Mime-Version:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=5Y13tezS9osfEyeZZhDu0hB4QwVrkWFM3vdAGWXDL0s=; b=Xwq48U/i0HDZtzIZsGIeaErx25 gQdO0RfD79Rm9N/A+11eCBG8KRfBNa3xc5435GUDIublO83qxRXbayUc83THTro0oZNTc5nHYlkoz MvsG7a7Wi+fdcUoB6OrT9ZhxFfH10hUqCIyBEOxbkOsLNXLm4kVywQPHB06QHYo2nhjedjRVyP7wM gsAlA+VmgJttyLWSwkVzb2qN/A5qfFdjw9HkCeGApNvlLQIBkYiYdw7DJrSgNlO+5BizF414tSvPP ykYvGhehnHqIs2xpQRYGojrQ7S0EaNt0bk36OUmEjGvzMesYhaPV62bTeeBAGPotSK2fcJSj5YsMu 53y0xXkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLW8g-0000000GStf-1wm7; Wed, 11 Dec 2024 23:29:06 +0000 Received: from mail-pg1-x54a.google.com ([2607:f8b0:4864:20::54a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLW7b-0000000GSRx-3o20 for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 23:28:01 +0000 Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-7f80959f894so1058138a12.1 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=lists.infradead.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=5Y13tezS9osfEyeZZhDu0hB4QwVrkWFM3vdAGWXDL0s=; b=005YUguGRwxsPz7RxssW6j3WdFTxdi2KvGm+FJxDmyTN5lFMRvkwP4XfgmbloMI1dM qLrBEkQ2NBHedrYe072QyxyYrI24eu17D7T9fB4MlJk8cBoDtLZ40i2JSOHYVmzYUWHn ZiSgIemQ9TpOVNO9pb1B0fSG4UstqHvwPjqxM/3faHkm0KO+/OdRAr91qyT73kv3TVRQ LTUnDQSzc6riAvAajVt4FpYqw+zfUXFZx2nb9qhL+c0yLhVjK+gjDbWLDg0AuclkxJ1M SIeyrjW/UA7QrhA9q8NC0lASFQV30CZSO7lfWxnETfVZ8hYpY89j8FOjVxVDtNyulp3/ jr/Q== 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=Q3/3I9+e7Sql7jXrE/oq8o505hMszkmGSLTB3uYxg0RJbmEl/uquI0lo5yxVXKDZjt nBPLtEJwHasMz42pjWU6p1EOB/QsP9pmOtBZLEX2iGnrcpq49pZQQs4q66t5Tcmlwfj7 23lkz/LiYzw/mlV3GIZsHgvrtLk12JTsWGxvcOqyc9ek/Y4LS4dlTQQt5ul6kKmqvsG2 zKYxGvVMZetHVEZ5Ru7EHZUUHjCjckRHpMXbqiYxjH/mjABIi/eOUIcoxoZaMg3PdlDD fpRLNiezrJXVYnIzDVT5PTf1Q0hGCjnKDG0DBP8UaTvkkw5vjSTZYMTYlt+/zmmhWpgg HhzA== X-Forwarded-Encrypted: i=1; AJvYcCVPjoGEZ+G8+rlGGDmz267O0R2KK5K1kRbZ4/0AOMWkXtnU/Yzo28dzmSUCZqkCCMStCLzrszwV54EIh2zOQYTQ@lists.infradead.org X-Gm-Message-State: AOJu0YyJ73iRaENk8WIwOtRgflJ94OP/vW6fTwLDd6Gx2LiG1+RNvhRL LfT23EmGf7bOAC5sBiRFYknSRpTAN2MmnAps8psHrwNWNyDXMUvcJs3f9m0CUkFJKfqtihTpUQU +Ngw7FOp8+pWuo97OofN7jA== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_152759_939415_BCFB3A82 X-CRM114-Status: GOOD ( 10.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(-)