From nobody Sat Nov 30 12:47:17 2024 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AFEE14EC64 for ; Tue, 10 Sep 2024 08:00:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725955253; cv=none; b=jLVGvJwaZYifikC0aoKBJiain9QXYoozDNGf+eeUGVfP0BFQFIRn4hYdiYbgFNoNtCgJH79H31GRrpx7bA83CDzGwF28qFFS29SUFUtLHFAI7N1BpcYsTK/Il1hSV80GaCl6RSskalwvWUAMcCesLQwa/3pxEhn347O6yZ9+D34= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725955253; c=relaxed/simple; bh=8RpvInZ904rjzrYDd/w9cypzUFS8kt+qxF7wc6Gm3Zk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hsroh0gqsEPM/96dsOHGkFUMPwcAumNkiiMCohowXqOTlwFBjqylC0UNkk4mgRVArq2GvLMpu59nMvPjcNnS7WPkSo0gdg1fy1Q3esWFLlsHZp+4woju4afM8KqBJVBcgZXKWQ/kiGmXFRTr7GnK2B5d11qSsFEzi7AjtlYlN9c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=EHkxGpw6; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Q9CnDgtj; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=EHkxGpw6; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Q9CnDgtj; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="EHkxGpw6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Q9CnDgtj"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="EHkxGpw6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Q9CnDgtj" 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== Authentication-Results: smtp-out1.suse.de; none 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWELVE(0.00)[12]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 X-Spam-Flag: NO Content-Type: text/plain; charset="utf-8" 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 =20 static unsigned long stack_maxrandom_size(void) @@ -73,6 +74,8 @@ static inline unsigned long mmap_base(unsigned long rnd, =20 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 =3D mm->mmap_base; info.high_limit =3D TASK_SIZE; info.align_mask =3D get_align_mask(filp, flags); - info.align_offset =3D pgoff << PAGE_SHIFT; + if (!(filp && is_file_hugepages(filp))) + info.align_offset =3D pgoff << PAGE_SHIFT; addr =3D vm_unmapped_area(&info); if (offset_in_page(addr)) return addr; @@ -144,7 +148,8 @@ unsigned long arch_get_unmapped_area_topdown(struct fil= e *filp, unsigned long ad info.low_limit =3D PAGE_SIZE; info.high_limit =3D mm->mmap_base; info.align_mask =3D get_align_mask(filp, flags); - info.align_offset =3D pgoff << PAGE_SHIFT; + if (!(filp && is_file_hugepages(filp))) + info.align_offset =3D pgoff << PAGE_SHIFT; addr =3D vm_unmapped_area(&info); =20 /* --=20 2.46.0