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 A660AC433E0 for ; Wed, 10 Feb 2021 17:41:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3B1C364ED0 for ; Wed, 10 Feb 2021 17:41:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B1C364ED0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AC1C76B0006; Wed, 10 Feb 2021 12:41:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A716E6B006C; Wed, 10 Feb 2021 12:41:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95DB66B006E; Wed, 10 Feb 2021 12:41:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 7D4B16B0006 for ; Wed, 10 Feb 2021 12:41:01 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 308B5AF79 for ; Wed, 10 Feb 2021 17:41:01 +0000 (UTC) X-FDA: 77803073922.02.sail24_3d09a8227611 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 10B9A10097AA4 for ; Wed, 10 Feb 2021 17:41:01 +0000 (UTC) X-HE-Tag: sail24_3d09a8227611 X-Filterd-Recvd-Size: 2818 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Wed, 10 Feb 2021 17:41:00 +0000 (UTC) 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: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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