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: 13900765 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 7CED5E77180 for ; Tue, 10 Dec 2024 02:49:04 +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:References:Mime-Version:In-Reply-To:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=10lySyzZTVvC+S5oM1O6pINxMohBlWGSJurdKiLL+/8=; b=YhaqBmCPskA1tLoPauTj1lGJV6 C0hEFrjhJIRRZMnzmwAFrJ8EOL5H36uUPOPKuHGThDI73T4j2Nla0BmlaI2XnJs//G8hRhcI75oGr yRT2ig9XdBViu1YjyZ/g2+OAmd4Hi/tK5qdzkVIKDl9UlhgCP4unFJiPOyswtSSW4SROLeR0TzYji K0YvQNC1DPmTy+40OwCuJtnJUC3GNDzyaLNA1fjC08trC+e7VHw2m7R/mqWUUIvQkiItJD078DxxZ BA3GoB7iHKafMLwgDPItYmGmjS30X+41bCwlIIanyJK1S9NBNp1JiexBuPYqHziooi2i/WgoZAZG3 xVWYDstA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tKqIt-0000000A1sU-1S6i; Tue, 10 Dec 2024 02:48:51 +0000 Received: from mail-oo1-xc49.google.com ([2607:f8b0:4864:20::c49]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tKqBs-00000009zc3-0Xpf for linux-arm-kernel@lists.infradead.org; Tue, 10 Dec 2024 02:41:37 +0000 Received: by mail-oo1-xc49.google.com with SMTP id 006d021491bc7-5f2b05e037dso1562982eaf.1 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=lists.infradead.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=rfrCZ2JmvamUidjdHw6ddztuPa9PU+vNkM45zozsBssYRN6NtCSDcnaGVx7kKdihvg 8Us2V+3M9ZSiXP3H0zbPXVdLuP8xZCEdXllgdchLJlOdhgnipVINVgOPet6H8MMJQhlO Bpo0MzVTXLY63cvWa+ympDJ4LjPAeOtGuUDW3n5t0Yq6xnSXg55JhHnnygOceM9YDASB m7YNA5b8mo7TNdrhRtFFMMiIfi7A4YcTxEn1w+jxV5TG3L5vfBPabN0FOfCITRfHbcQJ apNXgZmgn9O00r1HbrAr47fUck4Fx6LfAdagUIcKaLlqeW7FoTToirWrrsTa2/G4zKGa C+2Q== 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=AW3FerAMJREhWN4bwYW1ZSTK9lno4X2kK9XHT2iEjRDwTlguMwm1rUSMfjmSfTvNtO td0R67bjFwxJXs4pWkjZAb54Peiw13tYwTXflJPe4g3RAp8iF4REEOL1G13oElXz9kvz BkOPwroJeKGuYInQYJrGI31JofWXetfzyrP6PUuOV8kPJfyPMrs/vpWyA5Jda+tF9khz loaYCMYi5GnMBz83OaQ7xs1JFpoBD8HSGwPBHboPYK4haj/si59sNYnInGi6qbJp+f0G DSvJyDv+XzEFcSegGBtOiaXkho4XnlTSht5sgkcPcEd0QPFYKBAnhZu37++96wJwlzls mVzA== X-Forwarded-Encrypted: i=1; AJvYcCVsRcAzmHGdf4a/m0ajfHhiW6MAw0+b0+/jeHEwvNfh6ZOY5LNoJZa3Qa82pf5gvohSb7G+HRmn70G6bcWMO3ua@lists.infradead.org X-Gm-Message-State: AOJu0Yxytf6MofVLiCe5BJ41smfJpBZcqPk/c33npPrf96QOTcQjRlIB d+4Vmpz2PlrZQ/S99fvdPAJypq+tClCof1/uG9sEEHXvLPahTjt16yINHwNLgn2D5GIIVezxFeh /PK+g0hOSf5V6g5051bb/9w== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241209_184136_164946_3D380B41 X-CRM114-Status: GOOD ( 15.59 ) 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 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);