From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01306C433DB for ; Wed, 10 Feb 2021 17:41:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BDAD164ED0 for ; Wed, 10 Feb 2021 17:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232556AbhBJRl4 (ORCPT ); Wed, 10 Feb 2021 12:41:56 -0500 Received: from mx2.suse.de ([195.135.220.15]:55482 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232212AbhBJRlp (ORCPT ); Wed, 10 Feb 2021 12:41:45 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1612978859; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Mx3tg4rBq7bjCmW9+vOP6UmYfR5RusC/qOPIIHBwRDA=; b=dWzRg73qyAJPgmBG1X9h5D/M3UEAoTAw9Rkpruso/wSLvpd6K/TbgyrbyckYBIha1QRStm DcBZj0pykSFNUERVTHFZNlnrVrQ0FeLKNBwiC1Ot7Olyrfao5FIjyiFgLEkLHeyG2ONag/ Fef4JsEwVu9HjGgh3LC68hovuHhTZjA= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 376CCAE6E; Wed, 10 Feb 2021 17:40:59 +0000 (UTC) Date: Wed, 10 Feb 2021 18:40:57 +0100 From: Michal Hocko To: Vlastimil Babka Cc: Milan Broz , linux-mm@kvack.org, Linux Kernel Mailing List , Mikulas Patocka Subject: Re: Very slow unlockall() Message-ID: References: <70885d37-62b7-748b-29df-9e94f3291736@gmail.com> <20210108134140.GA9883@dhcp22.suse.cz> <9474cd07-676a-56ed-1942-5090e0b9a82f@suse.cz> <6eebb858-d517-b70d-9202-f4e84221ed89@suse.cz> <273db3a6-28b1-6605-1743-ef86e7eb2b72@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 10-02-21 17:57:29, Michal Hocko wrote: > On Wed 10-02-21 16:18:50, Vlastimil Babka wrote: [...] > > And the munlock (munlock_vma_pages_range()) is slow, because it uses > > follow_page_mask() in a loop incrementing addresses by PAGE_SIZE, so that's > > always traversing all levels of page tables from scratch. Funnily enough, > > speeding this up was my first linux-mm series years ago. But the speedup only > > works if pte's are present, which is not the case for unpopulated PROT_NONE > > areas. That use case was unexpected back then. We should probably convert this > > code to a proper page table walk. If there are large areas with unpopulated pmd > > entries (or even higher levels) we would traverse them very quickly. > > Yes, this is a good idea. I suspect it will be little bit tricky without > duplicating a large part of gup page table walker. Thinking about it some more, unmap_page_range would be a better model for this operation. -- Michal Hocko SUSE Labs