Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp619364imm; Wed, 20 Jun 2018 04:02:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLkUzeEwcylAjiDHVuxL1RiJlCLjPsbys/2tdBhFAqkRS8bo4+H6jEG5czlCQcPrP4vkgLV X-Received: by 2002:a62:d0c5:: with SMTP id p188-v6mr22512619pfg.101.1529492540348; Wed, 20 Jun 2018 04:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529492540; cv=none; d=google.com; s=arc-20160816; b=G1kNcZO9ghgtemyG/x2O6dp89lCHtsOdVE2Hny77VagsjDROwYvLMz2OMFhPe2VSVX iGIHxY/HwmioDinHtffAJX1dGpyM9C/oMjwlkMjjNhSGsQ0Y6XJMuLTEyHI43FYeZtZK xLiHFLYZx7O/GuNNU7fcz9GJpg0RwdLjQiU7iOs1Bk5YQlnNyjJosKw3zKFsHoNfYehz 1QBnc0uCsmQ9NYq0Czef2Tig5CcdLr7PQGX12tF4AU0+YhXDD9RDCGAQEmdWO/BWFQNz 4eBI6+InqW8qOKiVPqugcCBMDLayU1VuSkxUI7mWTWfbmAxzcAmz3PYeHRQldt6pNymv i6tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=cgokgg+zXoGD6HMP2T1pRs1GlV2vrwUBzKGEhfQ9mBk=; b=gdN2u6oH6Rfh7itdW5DcJqssdMeRCPqaAGviZ/FV3P8h5Jd3KeFXjFwIVe1abuL3dB 718nOg4CYsdFCiITEFp929sCX0UWeOfZMNGHXm2C765A32gcIhbxSGO5YLfCaThv75Bw VBKJle98P32VkAtul2n9ORENHQl+fcoVTPGghkXaKQlXNmPbRwQFb3CF+QpcKGWh4ONH tmhQoD3s2q0rK063TeH6dGKplYpjUag6SCaNU0pxitL2MPp9049b1TbzPmZTu9V2mWJx V57sTqYldKZgH+fCDyb/c5gMNFM80C6EmvqSUcKkjVQIeK6iMkdGBtN3IjfmlbLI5QdR JGKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v61-v6si2097934plb.499.2018.06.20.04.02.06; Wed, 20 Jun 2018 04:02:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752725AbeFTLAa (ORCPT + 99 others); Wed, 20 Jun 2018 07:00:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:40485 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbeFTLA1 (ORCPT ); Wed, 20 Jun 2018 07:00:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 71637AEB0; Wed, 20 Jun 2018 11:00:26 +0000 (UTC) Date: Wed, 20 Jun 2018 13:00:22 +0200 From: Michal Hocko To: Jason Baron Cc: Vlastimil Babka , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Joonsoo Kim , Mel Gorman , "Kirill A. Shutemov" , linux-api@vger.kernel.org, emunson@mgebm.net Subject: Re: [PATCH] mm/madvise: allow MADV_DONTNEED to free memory that is MLOCK_ONFAULT Message-ID: <20180620110022.GK13685@dhcp22.suse.cz> References: <1528484212-7199-1-git-send-email-jbaron@akamai.com> <20180611072005.GC13364@dhcp22.suse.cz> <4c4de46d-c55a-99a8-469f-e1e634fb8525@akamai.com> <20180611150330.GQ13364@dhcp22.suse.cz> <775adf2d-140c-1460-857f-2de7b24bafe7@akamai.com> <20180612074646.GS13364@dhcp22.suse.cz> <5a9398f4-453c-5cb5-6bbc-f20c3affc96a@akamai.com> <0daccb7c-f642-c5ce-ca7a-3b3e69025a1e@suse.cz> <20180613071552.GD13364@dhcp22.suse.cz> <7a671035-92dc-f9c0-aa7b-ff916d556e82@akamai.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7a671035-92dc-f9c0-aa7b-ff916d556e82@akamai.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 15-06-18 15:36:07, Jason Baron wrote: > > > On 06/13/2018 03:15 AM, Michal Hocko wrote: > > On Wed 13-06-18 08:32:19, Vlastimil Babka wrote: [...] > >> BTW I didn't get why we should allow this for MADV_DONTNEED but not > >> MADV_FREE. Can you expand on that? > > > > Well, I wanted to bring this up as well. I guess this would require some > > more hacks to handle the reclaim path correctly because we do rely on > > VM_LOCK at many places for the lazy mlock pages culling. > > > > The point of not allowing MADV_FREE on mlock'd pages for me was that > with mlock and even MLOCK_ON_FAULT, one can always can always determine > if a page is present or not (and thus avoid the major fault). Allowing > MADV_FREE on lock'd pages breaks that assumption. But once you have called MADV_FREE you cannot assume anything about the content until you touch the memory again. So you can safely assume a major fault for the worst case. Btw. why knowing whether you major fault is important in the first place? What is an application going to do about that information? -- Michal Hocko SUSE Labs