Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp6109110pxb; Thu, 27 Jan 2022 06:44:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTwQwzSnc3VP908f+34jXKPZFKPUi/4wd3FUV476tNM3AWlUKDPbPyqxDESvLz496n2fRA X-Received: by 2002:a17:902:9a0a:: with SMTP id v10mr3498362plp.50.1643294687901; Thu, 27 Jan 2022 06:44:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643294687; cv=none; d=google.com; s=arc-20160816; b=YzluvBtsMv7i2FtHEORoHJHd3bdMOfr+z0G41YktCUc4djN/vfAF/LIOaKTs+LVfPv Pd7kr/UDQp7yu04Q3wR6gKeEe4pJwqlY1iXalHiQ+l2TCBgmXs3NeRnRJbSxoDqv5YFN 2l6MlymVE2cYuI/YTpTyklwPdix3rK8tFT36VvmSvdix3RVqj6JXHuA6E4il5da/uDLj rvyPWLZ0uhksvJ+LxcEZgQNkUYirWPWT9WCRHCJnLsv+1qLAueN5PmQYe9XZfi6nOaBg ztkS+3ZHfdmAdnxs71SYmsCkrEc8JlA5/McGzqjrnpcRJeQQ0Uy2/iCfBcK1yTFy7YI3 RgNQ== 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=RvfIF1PSrQyzpcd2s2P7yJ25mW+a6Z8mNsXiEbSb9s0=; b=K1QCDamsKUg2rCLP00v74qz938kJOqBo84MGV431yRb+yis+kgPROoH8Hry3z8gM65 itNCAoiqgu3mgqOVc3D8IjghUuOAtAhGE4qVvXnaOqhDno3X3E1moFeQE5VqLeh71c16 Om+eEqF+rWsV93i3W8DZJGn+TIaOqwu957KSqzPz2xXx35aeF7ZIh6e6veO84myhgLei w+Qx4MhzwBG7WtL+EkpF6j+zp+1kpdNISL5I1cNo9xT2dS0VLJA08RBVGwK57DDE6x/0 e/H6fpKSWvw0T1BWHs1idLauFzVFw94a8HkLS6XC9nlaeNxTgdxKaO0mIgBhP6K8tiXi ULpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sJub49Uh; 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 s64si2277704pgs.339.2022.01.27.06.44.34; Thu, 27 Jan 2022 06:44:47 -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=sJub49Uh; 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 S238026AbiA0I4d (ORCPT + 99 others); Thu, 27 Jan 2022 03:56:33 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43588 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238000AbiA0I40 (ORCPT ); Thu, 27 Jan 2022 03:56:26 -0500 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 0505561B27 for ; Thu, 27 Jan 2022 08:56:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5EE1C340E4; Thu, 27 Jan 2022 08:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643273785; bh=lNqF3mJPDGw233av00HH2FDJ+SSvpcSySTuoi9rmynY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sJub49UhZPTd7ncg8oXuofMZCo6X6gobjlkjNoRy1y+1HXcBHY+U6J8JKdChxUTlV R0xl4kpRAEkFcrTPU6gRBfYM2BxXOpQfX0BtpGfzuTwNcRpzrCWaJ3MmUQBMghVCTG OJFATAVFmYipeykdrlEZh2HYxm7jdb1pXj5tnJIhqIMdphYOG3rB3n7imGJu7/k7J/ rn77s05xi4g8Zw3XSc5a2YXu5jj4cgL2/P/zPqnr5yAe0MevN/qqGNbO6QJsGtTWR5 RE2fUvXkZAa2V4Huqd6ilml4no4fCJ25F1FDH8W5K0+EfZI6s0cKz6wMJ2deM3cgez XB8H56ynUjqzg== 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 2/3] mm/secretmem: use __GFP_UNMAPPED to allocate pages Date: Thu, 27 Jan 2022 10:56:07 +0200 Message-Id: <20220127085608.306306-3-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 Currently secertmem explicitly removes allocated pages from the direct map. This fragments direct map because allocated pages may reside in different pageblocks. Use __GFP_UNMAPPED to utilize caching of unmapped pages done by the page allocator. Signed-off-by: Mike Rapoport --- mm/secretmem.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/mm/secretmem.c b/mm/secretmem.c index 22b310adb53d..878ef004d7a7 100644 --- a/mm/secretmem.c +++ b/mm/secretmem.c @@ -63,16 +63,10 @@ static vm_fault_t secretmem_fault(struct vm_fault *vmf) retry: page = find_lock_page(mapping, offset); if (!page) { - page = alloc_page(gfp | __GFP_ZERO); + page = alloc_page(gfp | __GFP_ZERO | __GFP_UNMAPPED); if (!page) return VM_FAULT_OOM; - err = set_direct_map_invalid_noflush(page); - if (err) { - put_page(page); - return vmf_error(err); - } - __SetPageUptodate(page); err = add_to_page_cache_lru(page, mapping, offset, gfp); if (unlikely(err)) { -- 2.34.1