Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1502777pxb; Wed, 10 Feb 2021 09:45:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxy5fpDMpBsA1oxmZaL6/zfSzADMZuJCcRcSXVoh1wLw9irCbMz2D1VMxlgqE7yOEG735w X-Received: by 2002:a50:e008:: with SMTP id e8mr4123508edl.339.1612979108195; Wed, 10 Feb 2021 09:45:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612979108; cv=none; d=google.com; s=arc-20160816; b=Y+tvWyu+yLlq3NAju2h41OKXxbfrcylR+VhCgMibU09vlhhg2PBh5cBxU1pC4J9j/x Nlry1kWz+pVtM7vGXYKedSUfHb2hmWM3RPcPilLi1jUOMEGHl9Zr8CA7FI03pUKTicA3 tK22s3KnKlO+pjjVjLx799j7zNi0YfCVT7vTo/196PZ1C94A+WtALS1DrfoZToDHGd2i U7JoR1OIsdhJq5CpPCnUt67q+Se1tJfv5DE4f4MVBP6Sq8/6WupKQ0B9VAHFoeRaQlN2 U5udI6ibMx9ILmGECihqXTER/hStIY1wk/ILcae4jdSzKrbZPSM0PzEik1epKwkH5Y3h m+bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Mx3tg4rBq7bjCmW9+vOP6UmYfR5RusC/qOPIIHBwRDA=; b=U0Q33XIaKWkAfBPSSAZizjkj3uyuES00xyuXXOVwDF2jCxW1dbdLNIv7jKsNpGnNVt jk++2/fkjFwSBN6nL1Irf8UBgG8OFMUdxtsXiHL2hheHGz0UwADK9wLoarCQnevGwGcI 3P8crks7b3mGIWzm/QYX6v8oJrq6Lxssp5QSNiZLkfuzcpX49ERD7+XP+EVKdBx8KUuN UI1qM5g8pn73sJSrA+SEaSokfwRZmewXIs2glfDOGHGH+e3Rw7Y26dK5Zc4nLrobC0w8 /xkwKeosPMuVvPJ8XVL7/fyCyZxqSyaj1nv0vEI+508cPj8hR+LHtUWyPGorSKVMUyXd pzSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=dWzRg73q; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si1834929edt.564.2021.02.10.09.44.44; Wed, 10 Feb 2021 09:45:08 -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=@suse.com header.s=susede1 header.b=dWzRg73q; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232152AbhBJRlv (ORCPT + 99 others); Wed, 10 Feb 2021 12:41:51 -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