Received: by 10.223.176.46 with SMTP id f43csp2748696wra; Thu, 25 Jan 2018 14:41:23 -0800 (PST) X-Google-Smtp-Source: AH8x227Qs/eZu0k5G+CDNK7AAtvdxw5yPGMttQS7rqcudvtDDcvQEuESmhB/ZQQFCKIhR01DXoHn X-Received: by 2002:a17:902:e85:: with SMTP id 5-v6mr6730770plx.208.1516920083003; Thu, 25 Jan 2018 14:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516920082; cv=none; d=google.com; s=arc-20160816; b=fwEkM4uNvhk+hwtOTC6pC04TxKaBq4klHPhQSjAMn0FinTPYsO/lB5smmth31Dcqke CwicfoF/OTDwWYwzCxvA7xvV0Z025SJZqpddvDnPSdOYkkpY5EGYBd5PJ6KGkg7ccPrw XCwDDBal3oOYUDh0ZDsbGDFOYhZkBO09SjNmZD2/MWXXx4DX36e4BJA+2ZE34COOvdtE AJ6NYCLBwkJ9SL7TGSbowPCxr9aFBMExx6Izyg4Qll14WlbyT+H6l9joMzIGbZDtLksR PCkuoORpYZ06NUjKwbR6n7m0z1hrwQAOJvN1FBGlETcfyslYn3t/Fo7TgI5Eit7flkHI nXKw== 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=hCOSjgUlGPpQznRDJfzX35HeRKZYECwXzSpylMwlLP4=; b=X1ew6xCzoY7rsguvshIMlns6Ntt1AojWullTBw1kYj9HMq0zqSQdhQCZWUtl+jmaah SzJp/QQpNuMiZd1072rnCDPfY2VIaXZg9TBWZPe1I+7dysZlosR98knCrQITxcuJFcRi eGHHodBzFL1LPOeANlRBXKtB023j9F3Ct0Ul0cY9ok835epo0PAK1/Ccjfw5XW/gl4g1 enKCLl1dBmNh1ABpq5OBlVrPXmpg0J39BUlLbRcPsGp7fl6ZMhMkJ2Sdt9ORM7HFK8RE cTb4bPjrmDeDOfFim1LRKW5Gx/65v9U6IugFTgIl6D0sBZu5bJAmClxEFyoUnjDgysjF tX6A== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70-v6si2647663ple.246.2018.01.25.14.41.07; Thu, 25 Jan 2018 14:41:22 -0800 (PST) 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751580AbeAYWki (ORCPT + 99 others); Thu, 25 Jan 2018 17:40:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54612 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751340AbeAYWkg (ORCPT ); Thu, 25 Jan 2018 17:40:36 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D7C1E85A02; Thu, 25 Jan 2018 22:40:34 +0000 (UTC) Received: from mail.random (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 184B05C269; Thu, 25 Jan 2018 22:40:30 +0000 (UTC) Date: Thu, 25 Jan 2018 23:40:29 +0100 From: Andrea Arcangeli To: Michal Hocko Cc: Nitin Gupta , Nitin Gupta , steven.sistare@oracle.com, Andrew Morton , Ingo Molnar , Mel Gorman , Nadav Amit , Minchan Kim , "Kirill A. Shutemov" , Peter Zijlstra , Vegard Nossum , "Levin, Alexander (Sasha Levin)" , Mike Rapoport , Hillf Danton , Shaohua Li , Anshuman Khandual , David Rientjes , Rik van Riel , Jan Kara , Dave Jiang , =?iso-8859-1?B?Suly9G1l?= Glisse , Matthew Wilcox , Ross Zwisler , Hugh Dickins , Tobin C Harding , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2] mm: Reduce memory bloat with THP Message-ID: <20180125224029.GB4454@redhat.com> References: <1516318444-30868-1-git-send-email-nitingupta910@gmail.com> <20180119124957.GA6584@dhcp22.suse.cz> <20180125095832.GN28465@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180125095832.GN28465@dhcp22.suse.cz> User-Agent: Mutt/1.9.2 (2017-12-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 25 Jan 2018 22:40:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 25, 2018 at 10:58:32AM +0100, Michal Hocko wrote: > Ohh, absolutely. And that is why we have changed the default in upstream > 444eb2a449ef ("mm: thp: set THP defrag by default to madvise and add a > stall-free defrag option") Agreed, that direct compaction change should already address the cases quoted in the other URLs. One of the URL is about using fork() to snapshot a nosql db state, that one can't be helped by the above commit but it's still unrelated to MADV_DONTNEED or memory bloat. It would be possible to fully fix the use of fork() for snapshotting without userfaultfd WP mode, by just adding an madvise that forces 4k CoWs on top of 2M THP and to call it in the parent that keeps writing to memory while the child is writing the readonly copy to disk, but I believe userfaultfd WP will be way more optimal as it provides so many other advantages (i.e. avoid fork() in the first place and use pthread_create and be able to throttle on I/O and limit the max memory usage to something less than x2 RAM without the risk of triggering the OOM killer and have a ring that is written immediately to keep the mem utilization low etc..). Thanks, Andrea