Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp6109123pxb; Thu, 27 Jan 2022 06:44:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPVJij9Y35Vqfw4EpG1Vbo1pX9CV1koTEixVQGKmvSbBOFJpO4ziWSciJP42BPmJmt2YNu X-Received: by 2002:a63:4809:: with SMTP id v9mr2975806pga.316.1643294688765; Thu, 27 Jan 2022 06:44:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643294688; cv=none; d=google.com; s=arc-20160816; b=VbWiZWQE6R7rpsOosvLMW4PvB6+4eg3dSUaG3Wv769+wRsI4zXDO+ktBJyOhLoDvgH NKfsn0am/P3AFDirLm6dSe22gmwcYm7mEPKogvFeUCdjXmRMnEsoNM63Arp10Vi1r4vg qncjnL5f1uyKiUMzfcnuUakax+N8s1j8wktbhdhCdV6Akz3KrPd+qQxKJ/7tYscAIRJh qdoS0oQtdTvgXbnG19cjZR3QyHHc/5JeutR/wKIuJgYF0s89eXfuEheLzCU3+ahzWyO6 1HyLtgHYmfQ6F0+yn8FpT93h6TFhM1HH83pdq9+pS4XgbmSkoVZJ/E01lX0ra/1LLLa6 UiiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TgoX4F+1i7xE+0Mpri0OiwsUPLLXBxjK2Gz15L32/h0=; b=jSfhg1Tgj294NqP+jQnE+aR7ZTdGm0bUF+W8PXgy+babEZsnt8cs/uEr8iWi5HtBWc 2FoguBjRKJzBj9JYO4JGPesq7D5GJFVDeHrhdRuthegmfkLi3DgxdceXicicwINFQVGT jk00ADCldlEi7RglHRAcv8GqA8pKdGaMWW+FXUYz2jFhhAzopzvp81jnk9eSSIaeFKAH A0TBTI4pprc15OkuT48XF1OX1WyJGPFqPWWK6Hn/Z3EzvmsCUfuPvsy43amvPVBngUAA 2RUyWqaPNOGG6PZ/kSnyBk5toWSHFKQ8kN893x9tp++qv+PjcGPFYc1kg+JyZ2QzcRGu aQfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PdeB0IOj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i186si2258367pge.299.2022.01.27.06.44.36; Thu, 27 Jan 2022 06:44:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PdeB0IOj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238059AbiA0I4f (ORCPT + 99 others); Thu, 27 Jan 2022 03:56:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238054AbiA0I4a (ORCPT ); Thu, 27 Jan 2022 03:56:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E228C061747 for ; Thu, 27 Jan 2022 00:56:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D6AF61B1F for ; Thu, 27 Jan 2022 08:56:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0387EC340EF; Thu, 27 Jan 2022 08:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643273789; bh=CdUM/xw3G6lznVQt3NFsLntFbhnkWNalr2oPO1cWbtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PdeB0IOjH7cl+p7r/DVrnXMzWGpLTAqd7OeqfmR5lN0cQswaE9TQ6aDaVI3nQVMWG XoHl9bO+SG272yKyOFDqISU2IJw45i5Pq/n+j/ppeWnbAzxPVYRLz/NWmQpY4kSMvB xUEOdmh4J1oeda569iz0hqKGdwsogExt4lJCnta6F7gS2WpvPBTmm98TirE4gY4pV9 ilrA1lVskayUfHi3CDPLv25yxIFGYn1H+WjpHtr3OmSeg6BB+NXpIg1xgEUBvsMt7R SbZATL97Cpcc10wh9AMIHkhf0kCazy/3u2l4zKjEo6pIl0BjvXau/bg5zp51XEUcwg bRq46RA7wqkFQ== From: Mike Rapoport To: linux-mm@kvack.org Cc: Andrew Morton , Andy Lutomirski , Dave Hansen , Ira Weiny , Kees Cook , Mike Rapoport , Mike Rapoport , Peter Zijlstra , Rick Edgecombe , Vlastimil Babka , linux-kernel@vger.kernel.org, x86@kernel.org Subject: [RFC PATCH 3/3] EXPERIMENTAL: x86/module: use __GFP_UNMAPPED in module_alloc Date: Thu, 27 Jan 2022 10:56:08 +0200 Message-Id: <20220127085608.306306-4-rppt@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220127085608.306306-1-rppt@kernel.org> References: <20220127085608.306306-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport The permissions of pages allocated by module_alloc() are frequently updated using set_memory and set_direct_map APIs. Such permission changes cause fragmentation of the direct map. Since module_alloc() essentially wraps vmalloc(), the memory allocated by it is mapped in the vmalloc area and it can be completely removed from the direct map. Use __GFP_UNMAPPED to utilize caching of unmapped pages done by the page allocator. Signed-off-by: Mike Rapoport --- arch/x86/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 95fa745e310a..70aa6ec0cc16 100644 --- a/arch/x86/kernel/module.c +++ b/arch/x86/kernel/module.c @@ -75,7 +75,7 @@ void *module_alloc(unsigned long size) p = __vmalloc_node_range(size, MODULE_ALIGN, MODULES_VADDR + get_module_load_offset(), - MODULES_END, gfp_mask, + MODULES_END, gfp_mask | __GFP_UNMAPPED, PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE, __builtin_return_address(0)); if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { -- 2.34.1