From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BDD2C433EF for ; Fri, 8 Jul 2022 21:01:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A2FFC6B0072; Fri, 8 Jul 2022 17:01:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DFC16B0073; Fri, 8 Jul 2022 17:01:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A8066B0074; Fri, 8 Jul 2022 17:01:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7801A6B0072 for ; Fri, 8 Jul 2022 17:01:25 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4BF8620D1F for ; Fri, 8 Jul 2022 21:01:25 +0000 (UTC) X-FDA: 79665153330.17.E71FBCA Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf24.hostedemail.com (Postfix) with ESMTP id 2C7F5180063 for ; Fri, 8 Jul 2022 21:01:24 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 50678B824F7; Fri, 8 Jul 2022 21:01:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0B12C341C0; Fri, 8 Jul 2022 21:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1657314081; bh=WGcAaC29Qwm+W/bONYix7u+rJ5DNzW9/MWIUZj5tR3k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YlLpu1oaaxOGRH0LU+iwyibN+7e5DKpui3tIzzvCJWIYbLJJQBMsD+iLQKUv6OHz9 npugteknUNQCsxS2CBXccfacVZe32MDbFU0S+1v5dxeVeMzK1mWQEuqhNP3+ahaFhN 8Kv/rgrrYekMVCtuXNbFSkKO9ouruA88DNGNIJ4k= Date: Fri, 8 Jul 2022 14:01:19 -0700 From: Andrew Morton To: "Zach O'Keefe" Cc: Alex Shi , David Hildenbrand , David Rientjes , Matthew Wilcox , Michal Hocko , Pasha Tatashin , Peter Xu , Rongwei Wang , SeongJae Park , Song Liu , Vlastimil Babka , Yang Shi , Zi Yan , linux-mm@kvack.org, Andrea Arcangeli , Arnd Bergmann , Axel Rasmussen , Chris Kennelly , Chris Zankel , Helge Deller , Hugh Dickins , Ivan Kokshaysky , "James E.J. Bottomley" , Jens Axboe , "Kirill A. Shutemov" , Matt Turner , Max Filippov , Miaohe Lin , Minchan Kim , Patrick Xia , Pavel Begunkov , Thomas Bogendoerfer Subject: Re: [mm-unstable v7 03/18] mm/khugepaged: add struct collapse_control Message-Id: <20220708140119.6da1413a413214bc603423e3@linux-foundation.org> In-Reply-To: <20220706235936.2197195-4-zokeefe@google.com> References: <20220706235936.2197195-1-zokeefe@google.com> <20220706235936.2197195-4-zokeefe@google.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657314084; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2Vi46MUFKvNMNSbkTUKufGEJvJmiFCp9M40NXPaTXk4=; b=RcQuHj1hSMyOcPgWksey0fL6FKhc75eHw2nGTK6EoaNejcHdtNCfC9QUz+3isgUqpxHze4 mzQBHAIOyJt1Fr3Tldlxv7NHaTrSM+ACLHx0L4FXZHXq2jxgScUJVwmzYibF2ZVCYfs9TN RI73ahLyGfvY8gnAoN9WVmIfdvlrqTk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657314084; a=rsa-sha256; cv=none; b=KUe0mhncXNlVm8qhkBOXmqqVZhXXG9QLcPCfMelB2fkgUG4xuAUlsOOGLq7H9yXfYWXVXR TOAQV4aXY5CIraNIzzH5HLiGw9eXLEsSjHaAkdmt7RcjPxdZwIPjDdsjauxK/eaWSb4kpX qNNJ9UtbLBjSxfzsaTL6LGxskRR0Ong= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=YlLpu1oa; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Queue-Id: 2C7F5180063 X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=YlLpu1oa; spf=pass (imf24.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam03 X-Stat-Signature: 3zib68scai6pwuo6kszmjpmouhu31ms4 X-HE-Tag: 1657314084-187721 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: On Wed, 6 Jul 2022 16:59:21 -0700 "Zach O'Keefe" wrote: > Modularize hugepage collapse by introducing struct collapse_control. > This structure serves to describe the properties of the requested > collapse, as well as serve as a local scratch pad to use during the > collapse itself. > > Start by moving global per-node khugepaged statistics into this > new structure. Note that this structure is still statically allocated > since CONFIG_NODES_SHIFT might be arbitrary large, and stack-allocating > a MAX_NUMNODES-sized array could cause -Wframe-large-than= errors. > > Signed-off-by: Zach O'Keefe > --- > mm/khugepaged.c | 87 ++++++++++++++++++++++++++++--------------------- > 1 file changed, 50 insertions(+), 37 deletions(-) > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 196eaadbf415..f1ef02d9fe07 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -85,6 +85,14 @@ static struct kmem_cache *mm_slot_cache __read_mostly; > > #define MAX_PTE_MAPPED_THP 8 > > +struct collapse_control { > + /* Num pages scanned per node */ > + int node_load[MAX_NUMNODES]; Does this actually need to be 32-bit? Looking at the current code I'm suspecting that khugepaged_node_load[] could be a ushort? [And unsigned int would be more appropriate, but we always do that :(]