From patchwork Wed Jan 6 03:46:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang Li X-Patchwork-Id: 12000901 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 0A246C433DB for ; Wed, 6 Jan 2021 03:46:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0C1122BF5 for ; Wed, 6 Jan 2021 03:46:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0C1122BF5 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 312828D00DF; Tue, 5 Jan 2021 22:46:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C3A68D00D1; Tue, 5 Jan 2021 22:46:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18AF88D00DF; Tue, 5 Jan 2021 22:46:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0242.hostedemail.com [216.40.44.242]) by kanga.kvack.org (Postfix) with ESMTP id 0374B8D00D1 for ; Tue, 5 Jan 2021 22:46:31 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C99A6180AD817 for ; Wed, 6 Jan 2021 03:46:31 +0000 (UTC) X-FDA: 77673962982.21.push69_0c16664274de Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id AE39E180442C0 for ; Wed, 6 Jan 2021 03:46:31 +0000 (UTC) X-HE-Tag: push69_0c16664274de X-Filterd-Recvd-Size: 6212 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Wed, 6 Jan 2021 03:46:31 +0000 (UTC) Received: by mail-pf1-f173.google.com with SMTP id m6so951876pfm.6 for ; Tue, 05 Jan 2021 19:46:31 -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=ia3T9lH51tu7y+R0EYaTdraFolxNyFOaXfE+wHbQ90s=; b=gQmFYIszyna+5NCm4w9LI2ODYXjcW82FwgKp6ng8xujM/+XLy2i3dS2SACI81X3n5B eVfRL4iR9vNEH0QZFEv4DVobtoNc9KIRgir0o1crKn9kakcHL9tsBQf4zihh8Cz23Eg/ qniEfqf+PbYvQxOUsMw9Gmcd0HSkm74cMSDYpgX7KOypT8VlJ11ch2jW8FzSsw3k5WZB 2JIWm2+d99nWVBtt4OiAlhu6dxlVY861kKdj5jmH8XbXc+pqf7dl8rYEKDogWYuQ0PC5 xy7YKaRtfhtNkURBncmAEcQIkTznj/kt91wrG7vBj0ZzT2gxeNJlHCwfODq2KZAt0JJB FIRg== 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=ia3T9lH51tu7y+R0EYaTdraFolxNyFOaXfE+wHbQ90s=; b=JXxmV9Hca0yn0/lvLrmixvq7ftINWFQBBeRQVRDyPkdv2Z45e0BwPnGQu/IDNCnQZC 2N5Na8Z973RQcazl4enCfMoQm/blHMD9b4l/PxVMW5KR+xcZNWgfPg8ymlO9wtC5QKqS TqUcVoG3UnieEJQaY0SSE7iMd2BJOEmx+RO/SHkMhv5I+bZMGusOcEkukFP+BO5eaop+ GkPk/S9QMHj124xFgH4md5USdgP0bYbHBc/Ly9Wyzr6ZL+ap/0VRwkcwPSOZOM2Q7vhB 4MLxL+umcm7iGNYM3z+NJ5PJWQ3/ycUMR6+FY7BQ3LswCV4zy5tlLXyHv/ZKnjAzlb6c QkNg== X-Gm-Message-State: AOAM5313XvohVyA65kdctIJgyrU/SFbwsEA9wPxJeMha4tlq1T5tLdE2 pUIBk/mYx8KV92Osb9TXNNw= X-Google-Smtp-Source: ABdhPJzCH5bHYLdF/Qz96oCkl7pVnmQk98BbAJueSL8kyPltTtjeSYox/eN6Atoa0UgQ2EfsiItJ5Q== X-Received: by 2002:a63:f404:: with SMTP id g4mr2358027pgi.114.1609904790221; Tue, 05 Jan 2021 19:46:30 -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 gk4sm561632pjb.57.2021.01.05.19.46.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jan 2021 19:46:29 -0800 (PST) From: Liang Li X-Google-Original-From: Liang Li Date: Tue, 5 Jan 2021 22:46:26 -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 , Liang Li , Mike Kravetz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH 0/6] hugetlbfs: support free page reporting Message-ID: <20210106034623.GA1128@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 , linux-mm@kvack.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.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 during the 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 hugetlbfs, these free pages will not return to buddy freelist unless the size of 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 hugetlbfs, 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 duplication. It can be done later. Since some guys have some concern about side effect of the 'buddy free page pre zero out' feature brings, I remove it from this serier. Liang Li (6): mm: Add batch size for free page reporting mm: let user decide page reporting option hugetlb: add free page reporting support hugetlb: avoid allocation failed when page reporting is on going virtio-balloon: reporting hugetlb free page to host hugetlb: support free hugepage pre zero out drivers/virtio/virtio_balloon.c | 58 +++++- include/linux/hugetlb.h | 5 + include/linux/page-flags.h | 12 ++ include/linux/page_reporting.h | 7 + mm/Kconfig | 11 ++ mm/huge_memory.c | 3 +- mm/hugetlb.c | 271 +++++++++++++++++++++++++++ mm/memory.c | 4 + mm/page_reporting.c | 315 +++++++++++++++++++++++++++++++- mm/page_reporting.h | 50 ++++- 10 files changed, 725 insertions(+), 11 deletions(-)