Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp402221imm; Wed, 13 Jun 2018 02:14:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPnDQhiYCJH59CGDYXj+qmgnW6+jVjh7kYEsR1XV06n9pkpMgiiFigx5cNn2L1VbUuv0Ab X-Received: by 2002:a62:e097:: with SMTP id d23-v6mr4075416pfm.81.1528881276705; Wed, 13 Jun 2018 02:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528881276; cv=none; d=google.com; s=arc-20160816; b=WAHmyRicjVe8zN1kZCoDak/byk0QUA1Ucz3qezJz/f5AwRuvnOb5fhwsMTJzmHyUux fth2QEye3Y6epxRYku6Z0xUEAVccChHP0PGnAhS7HPpTBUioIt9CRVyWEZY/bLd5AbYq T2t+wUb7lMoYigukGdtnv3Dvgiy4CQe+V9YC4vW/4w1x1asocl/+hPgvzWDM/p5O5pZZ cvxmK/p+P44/OJM838deY7ZIxVJ4J2m8T1uzgIcGD5RIomtu1YUXOJZQDDvsljjN2qJm QQrrFpxiDqgf5YE7lw6L2EMsBvJ7TKmflKm92cdrbQiZDHG4B0sSTyg28JqH3Cp7MiKs BUOA== 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=HlFL5ecdHefYV/2GxoL4FIbavrF8yq8OdRc8av1CbM0=; b=KNuXjiK6qNqWaR2REpxjcJ01LbwgAbFMb+ghxD38fnDajALfaK7ECu6SW4NdrDglMQ yGs+3OGLVczIQVruPICJ51KsLceHQBjTfx2t1DQzxXNhaayUpQheeirV5lJqkpvouKnV LqNK8o4jU98rELFxSkrT5jJPZNPSGDcfboft+NoZRNQLpfXXyJa2f0jkvfzD1qONBOu2 d+4DXDzQbjYE8haT/FgatUhoLEUDSJXyvOMzqUw0vPuHnWX9G8/SHdNuqkdm9ySAKkr1 CB7CJFrAXHfBUFyRf2r7zH41Sx1nz9EhxlVPbkaNjLsoKkrseUTSdTC4UIYIAljKXPq0 QFZg== 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 z6-v6si2195798pfn.232.2018.06.13.02.14.21; Wed, 13 Jun 2018 02:14:36 -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 S934679AbeFMJOA (ORCPT + 99 others); Wed, 13 Jun 2018 05:14:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:50057 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934115AbeFMJN7 (ORCPT ); Wed, 13 Jun 2018 05:13:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 14E21ABF1; Wed, 13 Jun 2018 09:13:58 +0000 (UTC) Date: Wed, 13 Jun 2018 11:13:55 +0200 From: Michal Hocko To: Jason Baron Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Vlastimil Babka , 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: <20180613091355.GI13364@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5a9398f4-453c-5cb5-6bbc-f20c3affc96a@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 Tue 12-06-18 10:11:33, Jason Baron wrote: [...] > Ok, I share the concern that there is a chance that userspace is relying > on MADV_DONTNEED not free'ing locked memory. In that case, what if we > introduce a MADV_DONTNEED_FORCE, which does everything that > MADV_DONTNEED currently does but in addition will also free mlock areas. What about other types of vmas that are not allowed to MADV_DONTNEED? _FORCE suggests that the user of the API know what he is doing so why shouldn't we allow unmapping hugetlb pages or special PFNMAPS? Or do we want to add MADV_DONTNEED_FORCE_FOR_REAL when somebody comes with another usecase? I agree with Vlastimil that adding new madvise mode for niche case sounds like a bad idea so we should better be sure that a new flag has a reasonable semantic. Just allow mlocked pages is more of a tweak than a proper semantic. So making it force for real requires to analyze what that would mean for other vmas which are excluded now. -- Michal Hocko SUSE Labs