From patchwork Tue Dec 22 07:45:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang Li X-Patchwork-Id: 11986071 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=-9.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 0A533C433DB for ; Tue, 22 Dec 2020 07:45:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 765AC2255F for ; Tue, 22 Dec 2020 07:45:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 765AC2255F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5971D6B0078; Tue, 22 Dec 2020 02:45:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 547D76B007B; Tue, 22 Dec 2020 02:45:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 436EF6B0083; Tue, 22 Dec 2020 02:45:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id 2617F6B0078 for ; Tue, 22 Dec 2020 02:45:47 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DB379249C for ; Tue, 22 Dec 2020 07:45:46 +0000 (UTC) X-FDA: 77620133892.07.foot28_011144c2745e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id C27DC1803F9A1 for ; Tue, 22 Dec 2020 07:45:46 +0000 (UTC) X-HE-Tag: foot28_011144c2745e X-Filterd-Recvd-Size: 6686 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Dec 2020 07:45:45 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id t22so7997295pfl.3 for ; Mon, 21 Dec 2020 23:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=VRDkYo9thmerq4KdUChRDJwyIpvZR7iVG1d7W9YK664=; b=kSA3yBOVbsQCzaPAuQH6tStOIQ/E8baYqDX1AfdkZa5M1+5DBspeYmZULpbRqxXD+U fQaVv9kv+Mtf/igPfGPa7XawbyxVGxVKz//jFSXO9yeb8NJT8f8hmL7701bLv8J3eIxq 7nV38OJW1hpytEGlibXvXB5dUA8m0RLzNnynboN8stOQYjTUBCqNr6BtyeMCWd192ljP rYcz2rqJlq8mB4D8jvuIInvBY8QVwyqd3o8dxktbz+SRltqqKld/55PyUgV0A9CHAfGH TscoLv12DE8n1IVSDpXqUWoVvTqCapkRn50yVPRV2wCy5FfilnYL3JK2a2Iy21dCVGE6 +glQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id :mail-followup-to:mime-version:content-disposition:user-agent; bh=VRDkYo9thmerq4KdUChRDJwyIpvZR7iVG1d7W9YK664=; b=je6EqUePVgq4gTRnlvWVfaCQf9uLqZi0Yp0eKjZhNUQPTOKzDz+WNe9ZL+MOZrtosE dSuGV6CPaUmMAdZke0oKMYaGEpVAvW9hgMp8+9w4EwPcq49ufqiyCREi4PkZdAHqVlJY Zek9rKq/ZwH2C1azAURnyiu5810yTfnXOQ55bzgyWTzOEMlmpjor7h0/DsTIODkvSjY+ uDLygBaQWCZVldjeHm3Wy1wvzXj5EDgfrh5jt2q6L+16v5FZnLGNoHiUL8oOTQjPx911 1mhhjQKTVTbsgcW4CMtdXPCiOfB/wIDuSsQa6pVtrag0qM9bPe4N1qAZb2w+Hi3lzYCt uF4g== X-Gm-Message-State: AOAM530vTZGiB1n52Opft/XsE2L49dt5fhJmp3vxl4YOQWt3NOFSbboO xgTPH20+snuSLfGf34g/d30= X-Google-Smtp-Source: ABdhPJwnYhUGB++74vbn5Y7LHAg9vDYkiZvJGTA7VuCwD2GqRVWfe30wNWf3GCWk4V3zvNw0Ev2joA== X-Received: by 2002:a63:f745:: with SMTP id f5mr18596744pgk.119.1608623144989; Mon, 21 Dec 2020 23:45:44 -0800 (PST) Received: from open-light-1.localdomain (66.98.113.28.16clouds.com. [66.98.113.28]) by smtp.gmail.com with ESMTPSA id mj5sm18247451pjb.20.2020.12.21.23.45.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 23:45:44 -0800 (PST) From: Liang Li X-Google-Original-From: Liang Li Date: Tue, 22 Dec 2020 02:45:41 -0500 To: Alexander Duyck , Mel Gorman , Andrew Morton , Andrea Arcangeli , Dan Williams , "Michael S. Tsirkin" , David Hildenbrand , Jason Wang , Dave Hansen , Michal Hocko , Liang Li , Mike Kravetz , Liang Li Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org Subject: [RFC PATCH 0/3] add support for free hugepage reporting Message-ID: <20201222074538.GA30029@open-light-1.localdomain> Mail-Followup-To: Alexander Duyck , Mel Gorman , Andrew Morton , Andrea Arcangeli , Dan Williams , "Michael S. Tsirkin" , David Hildenbrand , Jason Wang , Dave Hansen , Michal Hocko , Liang Li , Mike Kravetz , Liang Li , linux-mm@kvack.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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: A typical usage of hugetlbfs it's to reserve amount of memory when the during kernel booting stage, and the reserved pages are unlikely to return to the buddy system. When application need hugepages, kernel will allocate them from the reserved pool. when application terminates, huge pages will return to the reserved pool and are kept in the free list for hugetlb, these free pages will not return to buddy freelist unless the size fo reserved pool is changed. Free page reporting only supports buddy pages, it can't report the free pages reserved for hugetlbfs. On the other hand, hugetlbfs is a good choice for system with a huge amount of RAM, because it can help to reduce the memory management overhead and improve system performance. This patch add the support for reporting hugepages in the free list of hugetlb, it can be used by virtio_balloon driver for memory overcommit and pre zero out free pages for speeding up memory population and page fault handling. Most of the code are 'copied' from free page reporting because they are working in the same way. So the code can be refined to remove the duplication code. Since this is an RFC, I didn't do that. For the virtio_balloon driver, changes for the virtio spec are needed. Before that, I need the feedback of the comunity about this new feature. Liang Li (3): mm: support hugetlb free page reporting virtio-balloon: add support for providing free huge page reports to host mm: support free hugepage pre zero out drivers/virtio/virtio_balloon.c | 61 ++++++ include/linux/hugetlb.h | 3 + include/linux/page_reporting.h | 5 + include/uapi/linux/virtio_balloon.h | 1 + mm/hugetlb.c | 29 +++ mm/page_prezero.c | 17 ++ mm/page_reporting.c | 287 ++++++++++++++++++++++++++++ mm/page_reporting.h | 34 ++++ 8 files changed, 437 insertions(+) Cc: Alexander Duyck Cc: Mel Gorman Cc: Andrea Arcangeli Cc: Dan Williams Cc: Dave Hansen Cc: David Hildenbrand Cc: Michal Hocko Cc: Andrew Morton Cc: Alex Williamson Cc: Michael S. Tsirkin Cc: Jason Wang Cc: Mike Kravetz Cc: Liang Li