From patchwork Thu Jul 18 10:58:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 13736387 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 5F9E5C3DA61 for ; Thu, 18 Jul 2024 10:59:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B01B46B0089; Thu, 18 Jul 2024 06:59:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB2BB6B008C; Thu, 18 Jul 2024 06:59:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 953176B0092; Thu, 18 Jul 2024 06:59:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 776066B0089 for ; Thu, 18 Jul 2024 06:59:19 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3D4251A1ADE for ; Thu, 18 Jul 2024 10:59:19 +0000 (UTC) X-FDA: 82352576838.17.6EDA716 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf26.hostedemail.com (Postfix) with ESMTP id 232CE14000C for ; Thu, 18 Jul 2024 10:59:16 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=RCEaPyHR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=CDuhEnaY; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=RCEaPyHR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=CDuhEnaY; spf=pass (imf26.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721300336; a=rsa-sha256; cv=none; b=r49/o4gBb86xVcXHS8n+n8wHXdSFbNyWZ5hXLAtq3YPlgq8W/fYgH52Pjtk3pwhFhMnPdx +E9Fzxgu6h/+VWoWEHP4UbM/UkTe1KeSXxVXadQwfmFFCXU2gofTmxjpRcCT56flTgNGLf Q8PHdAxzX/A7eZvfNcCszHnkKpUC/TA= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=RCEaPyHR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=CDuhEnaY; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=RCEaPyHR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=CDuhEnaY; spf=pass (imf26.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721300336; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/YtBEq+futfpDK6VnLTGAsLUUeg4b//ccUCfgdjh03Q=; b=YSpcYi17GOd1OaxScuvf+e00JkM2XqEkNsra72g5Lj5n+BNamPxNK+JXrWABzbXXfb1T+E vdE7AFRJwn3ZgIpR6V9GyNYxc39M0Mb6pH+tdqpt4WvUyBDSUgp4MYjaIWDguZwFZ9K9z7 gNQP85R/75L6sYZcUvrf4WsZUDIF/Ts= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 95F9D21AD8; Thu, 18 Jul 2024 10:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721300355; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YtBEq+futfpDK6VnLTGAsLUUeg4b//ccUCfgdjh03Q=; b=RCEaPyHRDPlkfDCvQ819eOOfEcQ+0vrYU9ule7hx6xQDWOaYKbsDWj91KHSrZBm7Wa2ZXA 2sBeiZo8RXWvY2KC7S4RFP1na2xHi76mIPDQZXi8H1waAaTvryQGy/U2nNHYxzKcY6m1LJ GvGpWCJmuek9+pIN3/WXYVxlDw31Xxw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721300355; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YtBEq+futfpDK6VnLTGAsLUUeg4b//ccUCfgdjh03Q=; b=CDuhEnaYXEELncVh53GTkwlfSqTOIGXNHABa1+qHjSgFOe/UogyIgh9YcMFJ7OOOCdr6In 3SislPYiilqx9GAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1721300355; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YtBEq+futfpDK6VnLTGAsLUUeg4b//ccUCfgdjh03Q=; b=RCEaPyHRDPlkfDCvQ819eOOfEcQ+0vrYU9ule7hx6xQDWOaYKbsDWj91KHSrZBm7Wa2ZXA 2sBeiZo8RXWvY2KC7S4RFP1na2xHi76mIPDQZXi8H1waAaTvryQGy/U2nNHYxzKcY6m1LJ GvGpWCJmuek9+pIN3/WXYVxlDw31Xxw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1721300355; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YtBEq+futfpDK6VnLTGAsLUUeg4b//ccUCfgdjh03Q=; b=CDuhEnaYXEELncVh53GTkwlfSqTOIGXNHABa1+qHjSgFOe/UogyIgh9YcMFJ7OOOCdr6In 3SislPYiilqx9GAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 97C4E136F7; Thu, 18 Jul 2024 10:59:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id eCHDIIL1mGbnVAAAD6G6ig (envelope-from ); Thu, 18 Jul 2024 10:59:14 +0000 From: Oscar Salvador To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Peter Xu , Muchun Song , Michal Hocko , Donet Tom , "Kirill A . Shutemov" , Matthew Wilcox , Vlastimil Babka , Oscar Salvador Subject: [PATCH 2/9] arch/s390: Teach arch_get_unmapped_area{_topdown} to handle hugetlb mappings Date: Thu, 18 Jul 2024 12:58:56 +0200 Message-ID: <20240718105903.19617-3-osalvador@suse.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240718105903.19617-1-osalvador@suse.de> References: <20240718105903.19617-1-osalvador@suse.de> MIME-Version: 1.0 X-Stat-Signature: qzgp5utn4uhr4wsmm9uw786ixxu75p1o X-Rspamd-Queue-Id: 232CE14000C X-Rsp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0fMtZYFc0klByLd+Z5dLS0MxA2X2CexvB0SzwKShuO0Ab2ovKdv94NGoZT9tn0A5T8YHU8vbcXIGHiuwHNl01QDe/o0mEwAf53mLafZVVPWfSyqhv0UHzNtk5TQ72W6lBZqpkUVE6uLjODFizg69BG7Jnu6sNY987wKeeauQ4YD+Ha7GlJV1Ch9vehrWcuN06aRL0gUC1BZFmvElwzH3W5Yv31AZqHgy1z+NFMdKITiJLe0vGyAKKJQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: We want to stop special casing hugetlb mappings and make them go through generic channels, so teach arch_get_unmapped_area{_topdown} to handle those. s390 specific hugetlb function does not set info.align_offset, so do the same here for compability. Signed-off-by: Oscar Salvador --- arch/s390/mm/mmap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c index 206756946589..408b5a541a28 100644 --- a/arch/s390/mm/mmap.c +++ b/arch/s390/mm/mmap.c @@ -17,6 +17,7 @@ #include #include #include +#include #include static unsigned long stack_maxrandom_size(void) @@ -73,6 +74,8 @@ static inline unsigned long mmap_base(unsigned long rnd, static int get_align_mask(struct file *filp, unsigned long flags) { + if (filp && is_file_hugepages(filp)) + return huge_page_mask_align(filp); if (!(current->flags & PF_RANDOMIZE)) return 0; if (filp || (flags & MAP_SHARED)) @@ -106,7 +109,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, info.low_limit = mm->mmap_base; info.high_limit = TASK_SIZE; info.align_mask = get_align_mask(filp, flags); - info.align_offset = pgoff << PAGE_SHIFT; + if (!(filp && is_file_hugepages(filp))) + info.align_offset = pgoff << PAGE_SHIFT; addr = vm_unmapped_area(&info); if (offset_in_page(addr)) return addr; @@ -144,7 +148,8 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp, unsigned long ad info.low_limit = PAGE_SIZE; info.high_limit = mm->mmap_base; info.align_mask = get_align_mask(filp, flags); - info.align_offset = pgoff << PAGE_SHIFT; + if (!(filp && is_file_hugepages(filp))) + info.align_offset = pgoff << PAGE_SHIFT; addr = vm_unmapped_area(&info); /*