From patchwork Mon Jul 29 09:10:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 13744626 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 83704C3DA4A for ; Mon, 29 Jul 2024 09:10:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4284C6B0088; Mon, 29 Jul 2024 05:10:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 386E36B008C; Mon, 29 Jul 2024 05:10:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0ED426B0088; Mon, 29 Jul 2024 05:10:39 -0400 (EDT) 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 CF8B46B008A for ; Mon, 29 Jul 2024 05:10:38 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 91A0840205 for ; Mon, 29 Jul 2024 09:10:38 +0000 (UTC) X-FDA: 82392219756.26.9FD118B Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf13.hostedemail.com (Postfix) with ESMTP id 955C420005 for ; Mon, 29 Jul 2024 09:10:36 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf13.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722244197; a=rsa-sha256; cv=none; b=y2AjKCbb5nqMJc1054bgMgcAqrTBTwQ3InscbvLgIqhKemY7B+5sCy0ep9xYQJy0s+Weko RRWBYCqc7ePIXff1Rrq/wBY5ONxO8/wuoBHV/BM0vNtlVV6p4EeEyJlU7uYVMv+NiHitx9 m77XvVem1is1LLdrWmJvyXp6SCIc3UA= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf13.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722244197; 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; bh=/YtBEq+futfpDK6VnLTGAsLUUeg4b//ccUCfgdjh03Q=; b=qZpK+0dzSyL5Ja8IRhSKEo8XyOQnXNLx5qoJulgMRFgNX92pUfXPVjTCgoXSi6BQASwCTs fUNw1VuOvOfaiVZN0y6kTarcC/wJ+5sUptuP6puIu0UQaf/s0gX89N8j8LYFTsurPfyybX T+8V+qmqwxoC7wARJSySMgsTCS6+ons= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out2.suse.de (Postfix) with ESMTPS id 56E361F78D; Mon, 29 Jul 2024 09:10:35 +0000 (UTC) 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 1030C1368A; Mon, 29 Jul 2024 09:10:33 +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 GAkEOolcp2Z4BgAAD6G6ig (envelope-from ); Mon, 29 Jul 2024 09:10:33 +0000 From: Oscar Salvador To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Peter Xu , Muchun Song , David Hildenbrand , Donet Tom , Matthew Wilcox , Vlastimil Babka , Michal Hocko , Oscar Salvador Subject: [PATCH v2 2/9] arch/s390: Teach arch_get_unmapped_area{_topdown} to handle hugetlb mappings Date: Mon, 29 Jul 2024 11:10:11 +0200 Message-ID: <20240729091018.2152-3-osalvador@suse.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240729091018.2152-1-osalvador@suse.de> References: <20240729091018.2152-1-osalvador@suse.de> MIME-Version: 1.0 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Rspamd-Queue-Id: 955C420005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ieubk1qj9ogtyrkwkb3ry8whxe9djheu X-HE-Tag: 1722244236-453920 X-HE-Meta: U2FsdGVkX1+q2zBU/vzSjeBzQl45+gRTKllKkRtDHt0/g8PXyt876ASQfcGAoqYQYz3MT3PgVaeB+T+YzoMYeoN1ChLzkXoiN1TdB/P5XcSc6rtuwJ/8DFmRjiJSrHQSOaKit6dzrmyjwdiaFj9hf5h0JTsnr8Tw2L+UVMq2wjGdT7zl6hjc17EiHX/kwgWtCnNRQamB8RfYdDMuI1p9HBsowuXHzIureIqQUL+BhwFuJJTfMXSec2UYboffMlLSnZ9+2KxVmLIwJgz+6uiuz3MUEp85LytYy/rqC96hLLbl0lg+1SJSbyj0/nAM1SwRPznX/xtzDGEw6vuM9JGS2r/D0pRFLp1pO7ncm3FQIW4biZ/vD2D1EQSAp75oKeOjxqNrUaM6gEcnzMq61u6+nnJAoa5wNyBzK0pTop5HtAgu7UNJWkxblvXppuRiTStjtsAo43QOC9Hk16LolPwQ8N1qVWoF3z5B9pk66qZ9gvuG/WtHVDkCQWW0zDAg7gOTSJ1WNLhiIngFMlZohvLUkzvyMgb20lJ0abdEUr1robN5SY2GZv7St+dKAe3KpOhVcBcqCMbkCLHwFdw6eEfXWLHgHFNNyO6AyTCeDQv/AenzlbwB4tEAMwozEyvW3Y98DdyEjKnlmWH9vjAIHwIByfpxa+n5LARwFo8CiS0V2yFY+R5KOclauxr7xaYLleCPELJe7U9lAGDEu6x5QVgSp8UglhqHRZyHftzlAm3lq7BoU1w8ZwDI5vOgA1V/2umPjZ18oGi147WIqiHE5z7TsbiawAhT3R5RYdQcj6q6hjIk5h1ar+O/P0hA0gOWz30hbrhrBx9SY4KC3a0Z4PYtSTHP5GAozu3EZ7953LUFqzPT1AtkJPOAZ8eFJkSk058TlMVgdOaOTZhDG+xzHmFj6PiZJ1dKlUp+Xwm69a1hM85F/N7Tmw48mwx4f85WWSEGXk7bX3+h4ZV8eETYw/3 k30VPs7W 8xFK96QVy46cmWfcFWArFuCbcEGmid1+0HOq5lGf2erxMSUGqOqHwkldSLyA9CxX9wScxVLAZalobyTz/LkRrRSJlUZqGDjvVSoON9jd8B6NW60T7LsbfQsehPqfTARLv9oNuFV/TVJG6nCJo07MbAkeuNNMLxCd2bqol5oTYHGXVTPg= 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); /*