Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp764733ybk; Sat, 9 May 2020 18:13:58 -0700 (PDT) X-Google-Smtp-Source: APiQypKVEyop8MP1WHLP1owbwWj4zSkFVVg+mFqwFlSu89B1Qrpikvg7OXGMoQXDaYWSROuOknHd X-Received: by 2002:a17:906:c06:: with SMTP id s6mr7752729ejf.198.1589073238486; Sat, 09 May 2020 18:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589073238; cv=none; d=google.com; s=arc-20160816; b=HX9BJ9fIWR2ENgIIuFIReXu1xZdH5t4MHVwwnJeqB/XCbkPA3t5bZggAeWCjdYEb/6 dCltRk6DqRGiNBdX2OfuiHBkk21o3qnGYf1Jy8LToBU7G0weQQpzxEGoeHODnX8IIE8l OIKGZABSJnaNuZkdLYEaP3TPesEse0NY7w94wtj9XAsjzy5sTwM4QJoNQiljubhbH1oO 5v7rUbLwHrs+nF6H/vBTZnX5k/Je3EO0KF6eRfRKFfoQ2A8P7gPGLZhPA9+1aOy+PcFe hJmpjQ/n9lJn6j32KBBGbNTbHCnrPISYYB913yoPDx2iuMH6LH+/SHY96yma+42+cyGH 6dow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=X7BNwZm/qeSoH9rk5fDt+Xdu9teDBRzeq1dYQOdzLtQ=; b=Gvvy7k0eTq/N2Y6trGZIV3WRgZnZY3zLFyTGxyrBgMMsWdP/d+ALdUqFknqOvLGtYx 3r5CBc9y54gy2A7uEcA1agnzQER+nZeWBS0eKIc/60updjX4uh81cQEoMwkPOmRx2iPQ Sv+dP33iGD0D2TroMr+R8u/gjwhBJi5KIjUlNSUdm5Nu/RKqV9Ws95K1aaRdD1+F9auL LHA15I3rNHQIjyXhjffuz0B7gC2kr5fhRdoztvrrfLFN9Z4E2VpkiIuzk1dY5ONSqb61 I99t0LyyxPHbDclXTFoZcrp0FOefQ/m5Sr6PIQxR83qFz+9qWYSK2ibHITLSdILqVWm1 MKpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=sIcN8Hg6; 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 b28si929491edj.456.2020.05.09.18.13.35; Sat, 09 May 2020 18:13:58 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=sIcN8Hg6; 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 S1728667AbgEJBMW (ORCPT + 99 others); Sat, 9 May 2020 21:12:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726565AbgEJBMW (ORCPT ); Sat, 9 May 2020 21:12:22 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A858C061A0C; Sat, 9 May 2020 18:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=X7BNwZm/qeSoH9rk5fDt+Xdu9teDBRzeq1dYQOdzLtQ=; b=sIcN8Hg6HHavcmr49SGf56f5l5 cGi+tKsydbSSSzCjWR/1pHj2ymlF3jcWYTC7vk+JghdQUSyROOh9UubwC6c0zHZkQG6ai1pkI+2Ma V6ipDtighug9Y32X8MvqrdHVOFND8L2TdBI2i7g84zgCvtl9ot/a1hme67GC5uPdWKoE9FYZ8MQyu B3grFCxDZ+7aGj7shhExulokE6uClW2/hoAFiDx+Ayb9tDRNTvHEYuDHtxPCMJTCKpwgTsmKJ1QcF qbWrcUfYDp2hx5vDhXGC9xkmE+2FiwRn3Musd1aFQlEOtnuNp+KcxXSSopMDQ61GtAgRzCe/LUq6b HZF01I8Q==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jXaVZ-0008UL-UC; Sun, 10 May 2020 01:11:57 +0000 Date: Sat, 9 May 2020 18:11:57 -0700 From: Matthew Wilcox To: Peter Zijlstra Cc: Joerg Roedel , Joerg Roedel , x86@kernel.org, hpa@zytor.com, Dave Hansen , Andy Lutomirski , rjw@rjwysocki.net, Arnd Bergmann , Andrew Morton , Steven Rostedt , Vlastimil Babka , Michal Hocko , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH 0/7] mm: Get rid of vmalloc_sync_(un)mappings() Message-ID: <20200510011157.GU16070@bombadil.infradead.org> References: <20200508144043.13893-1-joro@8bytes.org> <20200508192000.GB2957@hirez.programming.kicks-ass.net> <20200508213407.GT8135@suse.de> <20200509092516.GC2957@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200509092516.GC2957@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 09, 2020 at 11:25:16AM +0200, Peter Zijlstra wrote: > On Fri, May 08, 2020 at 11:34:07PM +0200, Joerg Roedel wrote: > > On Fri, May 08, 2020 at 09:20:00PM +0200, Peter Zijlstra wrote: > > > The only concern I have is the pgd_lock lock hold times. > > > > > > By not doing on-demand faults anymore, and consistently calling > > > sync_global_*(), we iterate that pgd_list thing much more often than > > > before if I'm not mistaken. > > > > Should not be a problem, from what I have seen this function is not > > called often on x86-64. The vmalloc area needs to be synchronized at > > the top-level there, which is by now P4D (with 4-level paging). And the > > vmalloc area takes 64 entries, when all of them are populated the > > function will not be called again. > > Right; it's just that the moment you do trigger it, it'll iterate that > pgd_list and that is potentially huge. Then again, that's not a new > problem. > > I suppose we can deal with it if/when it becomes an actual problem. > > I had a quick look and I think it might be possible to make it an RCU > managed list. We'd have to remove the pgd_list entry in > put_task_struct_rcu_user(). Then we can play games in sync_global_*() > and use RCU iteration. New tasks (which can be missed in the RCU > iteration) will already have a full clone of the PGD anyway. One of the things on my long-term todo list is to replace mm_struct.mmlist with an XArray containing all mm_structs. Then we can use one mark to indicate maybe-swapped and another mark to indicate ... whatever it is pgd_list indicates. Iterating an XArray (whether the entire thing or with marks) is RCU-safe and faster than iterating a linked list, so this should solve the problem?