Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4783190pxu; Tue, 22 Dec 2020 00:11:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzB+PsjosM0qANeVqLe6C+HlCuSMKKp/v51m4ESwZ6pHJcYXkdL0Nmg0c1Q06etKUSnOz2Z X-Received: by 2002:a05:6402:7d7:: with SMTP id u23mr18962377edy.325.1608624684558; Tue, 22 Dec 2020 00:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608624684; cv=none; d=google.com; s=arc-20160816; b=XOp1Y1n9d6s1L8DIebOySQfY/mdbYzAeJjQpO8FdloV5INHmLoba1Gzov0n4bAfHDZ fPnq43SiClaZzRQmLnmic6x/E1XPTZ+sr5fFNv4m9oT3B51N67kSGokmmLaAesSsqBDw RAArHuOUpEwbjz46LMWOXNsS5Dc0KO266Cr4G2Kg4hRxyASrJlvJwfmyopiCeaUEclHP TW0+UQw7Bcw4DEigzRaDCiGn1L4XFcJC8qCiEKePeBdR6koHB1IkfjwyZ4U4QdnN3FfC 6Pt+pQWXocjiSP87JpJo/NwcB1k2Okl7cqdU8gQu+RmSIQ9+qbZoWyWqvtMFEJPvzOOx XNxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :mail-followup-to:message-id:subject:cc:to:date:from:dkim-signature; bh=vZw5nI+kCEEx1ompDMl4HBZSoNTPvUzGrnmedcFZpg8=; b=pxmWna3Dlgiu2jWhREXWrob8Ksjpu6KCK3IebkpsYK4jejVOl5UrKlQnJ9fPXG/Whc cswnKB0M0tiQsjeoU6kpSy3x9cHXJ73l3EfKdOKlLbIPUikEvc3yCnputUXl3UJ2BlRT mJnvTSEdUae6bN614WuXtfWUeg/4ZjwxSEnFuWv7lBndasvoD1qJLbFH2zt8/cvGxueK tzjYrBon0H36Ew3CJ3QaiMQ7SLwnp6Ypn1Fn8rR6+Vc/jCZwiTu7Od3GI1iZG1NymYWg u9ereEKLvursOJ6IBnHWmePIfK+yDd5K3O5BYvKS/oe9eyTv2yKQb2sNoIVGjsG2JYXL 9V1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vLBLjFXh; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x31si874107ede.198.2020.12.22.00.11.00; Tue, 22 Dec 2020 00:11:24 -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=@gmail.com header.s=20161025 header.b=vLBLjFXh; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726137AbgLVIKI (ORCPT + 99 others); Tue, 22 Dec 2020 03:10:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbgLVIKI (ORCPT ); Tue, 22 Dec 2020 03:10:08 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14797C0613D3 for ; Tue, 22 Dec 2020 00:09:28 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id 15so7894178pgx.7 for ; Tue, 22 Dec 2020 00:09:28 -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=vZw5nI+kCEEx1ompDMl4HBZSoNTPvUzGrnmedcFZpg8=; b=vLBLjFXhc52zVGGaPxpIaxjR0vZSpL4RJWvs/u4ZFgQIPhGnSO8vUxUyOcQJDcwroz C+CTv3VfTYEwuZT78zrciQhiqjjm9XFc64y7aLEnzHkfKaU6BF6++zXrtUq+Z46GXtOB 83tycbWqXdmhMnIMeVoOtsIEzFSxkjVYZx5+qQyKUWt2KfgiAQ5bcxBoqDXLrfG4/5qR yDH+Z6StmiHIPJOs9WVqVp6OjWoM0TD8ZuWL6g8zF2FM8B2otSpqjFND+l1OZECDxkc/ p4UBrcQV0WZZuJuQJ/ENRZJpMKr2E2AH94CsEQKR0vjN4J3Oc2XTyrm7eO0i9y+gwghf 1eCA== 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=vZw5nI+kCEEx1ompDMl4HBZSoNTPvUzGrnmedcFZpg8=; b=eWBWDLHJhl+B/0x5cramagBFL7rW803EKViE4+GjjfudqUDc+a1RXfyJGwub8aPouU LZOxW7TGhCdC63G0yv5odXHy09OP+diMwBnq+8TDXed9Y1TWD1FMtbFx2YrqnRUzbh2R QyFTgGAw2E0jOtuo3fRakBJka11J8urFNgKzL5XgMEsHEQq3om+fD7PJ9lUIBC+y5uar LWCAcdCyhIf1cefSNFB9brm8vVRwVcKjldK9VKBkk9vd/lrLM3wqWr8YAJUyzW58AXE5 PLMV8Qy/EQazhy9oGEFKP3GnDE350TqxrZkIht2FfWR3zyS3CeHQEfkWNEdP59T0P2G3 GxSA== X-Gm-Message-State: AOAM530TGPXZOcgmS3nujjeATCYRBgXYHsOfVwq/Qg7c4rV22s4mjWcK pWeMlsYxncuDRcVEpAidxjI= X-Received: by 2002:a63:1e1a:: with SMTP id e26mr4591379pge.66.1608624567657; Tue, 22 Dec 2020 00:09:27 -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 r14sm13345752pgi.27.2020.12.22.00.09.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2020 00:09:27 -0800 (PST) From: Liang Li X-Google-Original-From: Liang Li Date: Tue, 22 Dec 2020 03:09:24 -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 updated] add support for free hugepage reporting Message-ID: <20201222080921.GA30259@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-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A typical usage of hugetlbfs it's to reserve amount of memory during kernel booting, 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 duplicated 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. This RFC is baed on my previous series: '[RFC v2 PATCH 0/4] speed up page allocation for __GFP_ZERO' 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 -- 2.18.2