From patchwork Tue Sep 10 08:00:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 13798079 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 9056CECE582 for ; Tue, 10 Sep 2024 08:00:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E27298D0025; Tue, 10 Sep 2024 04:00:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD7208D000E; Tue, 10 Sep 2024 04:00:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C77EF8D0025; Tue, 10 Sep 2024 04:00:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A4DC28D000E for ; Tue, 10 Sep 2024 04:00:54 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3C955AA06C for ; Tue, 10 Sep 2024 08:00:54 +0000 (UTC) X-FDA: 82548082428.05.E9A9AE1 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf27.hostedemail.com (Postfix) with ESMTP id 0166740004 for ; Tue, 10 Sep 2024 08:00:51 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EHkxGpw6; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Q9CnDgtj; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EHkxGpw6; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Q9CnDgtj; spf=pass (imf27.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=1725955150; 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=Sr2a885zzyye8BXAHIM5ZgoDsL83/5XNiIIL6NfSFFI=; b=ucqAIn7vJixZYarjjfa3IVsQTI6xnRCHEMh5OLPLNHDaxkmULrsRsYKjfAdSiJ4JJ6bWd+ n38J+1Bd+/RGjpnWyJsHJIcQVkFu11hBrfAaZH46fyG4P+bP4NsqnMxNw4yjo+5LRItouN 9jp3UKaRlwcPLnrABnxLgBcijeBq4xo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725955150; a=rsa-sha256; cv=none; b=pIrhMDu07r6cwxEC0x2jdS5qJhQ4JJ3L/AUjQ5HGu9Z9YiT+HZv6t8JGvcNipA9WZSU+nR Qb8oNnl9ZnWfkqYZLs+wYuvynpxaaFMLwi8XOihRfpa2F35W/nbk78KPJcOHi2MM7df61O A/s/csA7rH4h64RUKehgxr+PfW98RcQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EHkxGpw6; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Q9CnDgtj; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=EHkxGpw6; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=Q9CnDgtj; spf=pass (imf27.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 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 3525721A27; Tue, 10 Sep 2024 08:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1725955250; 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=Sr2a885zzyye8BXAHIM5ZgoDsL83/5XNiIIL6NfSFFI=; b=EHkxGpw6SXl/ZSTSwdFHmiqjuZYwYlDZuV8GMLVE2LwaWE2nmU9JioHe8WmAUmfETIqwDP cAioIqOiC1DYc5bdgzpHZhT73SJYRTjqHQQ3Ia0y9aKTKEob+MTPgj+PkphpQLQ0UGflQ7 m+216c9puWvPIyrkIIf5SLM4I3zikXc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1725955250; 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=Sr2a885zzyye8BXAHIM5ZgoDsL83/5XNiIIL6NfSFFI=; b=Q9CnDgtjmYwf/fFqqitTqsQlpYO+d9y2X477u0d6IW2VHKIomEkcmiU+tQWtOtY9uaZQLX zCQeNwwM8f69srCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1725955250; 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=Sr2a885zzyye8BXAHIM5ZgoDsL83/5XNiIIL6NfSFFI=; b=EHkxGpw6SXl/ZSTSwdFHmiqjuZYwYlDZuV8GMLVE2LwaWE2nmU9JioHe8WmAUmfETIqwDP cAioIqOiC1DYc5bdgzpHZhT73SJYRTjqHQQ3Ia0y9aKTKEob+MTPgj+PkphpQLQ0UGflQ7 m+216c9puWvPIyrkIIf5SLM4I3zikXc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1725955250; 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=Sr2a885zzyye8BXAHIM5ZgoDsL83/5XNiIIL6NfSFFI=; b=Q9CnDgtjmYwf/fFqqitTqsQlpYO+d9y2X477u0d6IW2VHKIomEkcmiU+tQWtOtY9uaZQLX zCQeNwwM8f69srCA== 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 7B79F13AB1; Tue, 10 Sep 2024 08:00:49 +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 KFhkG7H832Y2MQAAD6G6ig (envelope-from ); Tue, 10 Sep 2024 08:00:49 +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 , Vlastimil Babka , Michal Hocko , Lorenzo Stoakes , "Liam R . Howlett" , Oscar Salvador Subject: [PATCH v3 2/9] arch/s390: Teach arch_get_unmapped_area{_topdown} to handle hugetlb mappings Date: Tue, 10 Sep 2024 10:00:23 +0200 Message-ID: <20240910080030.1272373-3-osalvador@suse.de> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910080030.1272373-1-osalvador@suse.de> References: <20240910080030.1272373-1-osalvador@suse.de> MIME-Version: 1.0 X-Rspamd-Queue-Id: 0166740004 X-Stat-Signature: g3ugwp9zmkobahbkgxg5qw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k2vuAajPLCRvdjGA0hJ8m1cPS3ami/uKjqmXGYOgQGvrQPvotbxa+3vyT/y9KWxGCL7V/z5D4BuHMX2Mp680NGXHP9Uvgm+5r0FgfFlizZMCWt1GTCnospNb1RIoV3osSWThmQ9o3dHS2Aj6l7zjcotB7Sn0On3j++B3Q4vtlz2rq7rv8PXER4s7y0yKorUy9q5vkWqne10kQuej+IiHXONZBi5ztN2cpLWUoJF+dL2Vt9l+YMYk3bUVx5ow43e5hNZHTw== 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 compatibility. 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 96efa061ce01..33f3504be90b 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); /*