Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp346049pxk; Thu, 24 Sep 2020 07:04:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDbFIUfUQqwvNpaBk2LUx+5zhO8U0jA0vB1o2ylXqWsmvd/KjtaMqz0mo/2sXMAH5cwO4T X-Received: by 2002:a17:906:370a:: with SMTP id d10mr6087ejc.393.1600956299407; Thu, 24 Sep 2020 07:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600956299; cv=none; d=google.com; s=arc-20160816; b=rAowG5XWcqZnbJKYVS0QfvWHfDjUK6OyB4PHDbIYtC8P3/RW+N2NeW8khOp6qwVWj6 K3vyLbgbMEzMBR+NnUKpgJhZk05BfXKFhyJuo9wcHTOyc8tzAtpEAiZWzTcmKt9Be681 vr/qBEAtEd96hjGjJbUXtX7TGgHjX5t8wJXJRX61GlA53lkS3sFCI/v3WF713Y3ErMZK ycbzUNOX/s9dBJulPflGVUliPTmFI45P1/3rJRMLmtDl/vVDbvE9rwptyj9fq5bs2rX0 uQpRfWh0akenh7hzxEyqo6yA0WVAoARSk3zox5mJQdTeLZIkptc+aKhfctgDIJJgsEft qswQ== 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=ggovDsPrY2tPPXwEEhp2BvATO0PndCnAzmG0yva7UFo=; b=FZRRvfghIHqEcQokqYnv1J0mJEzNu1g5yrAhWICrCHlPqiQ2djWGDJmHl6rDit+YYs 2NVI+k7c4RXRFpYk9OFKGWi30FazzWRzJXJvn1F0ynmBmDxEVAzsCYqD+C/oaGE4tq8w Pt/oa1R7KKBDHqoFR4Y0W0puO3Ytx96QyGNUPoZtqeYbwqpcZAvq5jRg8rZSkcRtg6zT 76EtU+dieX/a78VBkX0W60BwBRjG1THwkW2G9+Vw5WVXxEmbJFEMAScNJS66GnhlPJf8 Ej1YQvjLZlA2GFX80dqf2C8yuvm6fyHG3HX9sPaWL140xbrqTyY4Oyr9DjRsxNoTaHvr N08A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="N/ootiBc"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si2214305edm.404.2020.09.24.07.04.25; Thu, 24 Sep 2020 07:04:59 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b="N/ootiBc"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728248AbgIXN77 (ORCPT + 99 others); Thu, 24 Sep 2020 09:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728166AbgIXN7W (ORCPT ); Thu, 24 Sep 2020 09:59:22 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 994CBC0613D5 for ; Thu, 24 Sep 2020 06:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ggovDsPrY2tPPXwEEhp2BvATO0PndCnAzmG0yva7UFo=; b=N/ootiBcR4K2DEtljvLh9Zsz8j DbEFzcIOE0vb5/auxrmD/v7F1fPZyK6x8XevpU2p1+DxFR61Kz4n2BdQhY7PcvEd65yA1YqQ3sAyF pTSgUibK1yPWO1iTqxeBk7th83prf+n0mxbb2hfZMlUdC5/JxXS5ILsH5bRp4j7IOJTV5juCRiNe+ wYfsnKqRVMCpAGLavfKGjMYbjftaTIPNfi4cWkqZxIlCFu2SUsHUM8AwGBdjeX/LOliursV56AQzK 2dc+y3VruLMxjnINrAWE9AoEhuzEFO5GRCpDD4ruqfyghrFro3F3Kt6tI6tk5tHePRHDdu3Yi/XUZ /MIWNu0w==; Received: from p4fdb0c34.dip0.t-ipconnect.de ([79.219.12.52] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kLRlz-0003vR-Sq; Thu, 24 Sep 2020 13:59:01 +0000 From: Christoph Hellwig To: Andrew Morton Cc: Peter Zijlstra , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Jani Nikula , Joonas Lahtinen , Tvrtko Ursulin , Chris Wilson , Matthew Auld , Rodrigo Vivi , Minchan Kim , Matthew Wilcox , Nitin Gupta , x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org Subject: [PATCH 05/11] zsmalloc: switch from alloc_vm_area to get_vm_area Date: Thu, 24 Sep 2020 15:58:47 +0200 Message-Id: <20200924135853.875294-6-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200924135853.875294-1-hch@lst.de> References: <20200924135853.875294-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just manually pre-fault the PTEs using apply_to_page_range. Co-developed-by: Minchan Kim Signed-off-by: Christoph Hellwig --- mm/zsmalloc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index c36fdff9a37131..918c7b019b3d78 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1122,10 +1122,16 @@ static inline int __zs_cpu_up(struct mapping_area *area) */ if (area->vm) return 0; - area->vm = alloc_vm_area(PAGE_SIZE * 2, NULL); + area->vm = get_vm_area(PAGE_SIZE * 2, 0); if (!area->vm) return -ENOMEM; - return 0; + + /* + * Populate ptes in advance to avoid pte allocation with GFP_KERNEL + * in non-preemtible context of zs_map_object. + */ + return apply_to_page_range(&init_mm, (unsigned long)area->vm->addr, + PAGE_SIZE * 2, NULL, NULL); } static inline void __zs_cpu_down(struct mapping_area *area) -- 2.28.0