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 B2ADAC433EF for ; Wed, 8 Jun 2022 01:00:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 03CF26B0072; Tue, 7 Jun 2022 21:00:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F2FEB6B0073; Tue, 7 Jun 2022 21:00:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF8996B0074; Tue, 7 Jun 2022 21:00:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CFD3C6B0072 for ; Tue, 7 Jun 2022 21:00:40 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A709D33FF6 for ; Wed, 8 Jun 2022 01:00:40 +0000 (UTC) X-FDA: 79553263440.03.E869A23 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf04.hostedemail.com (Postfix) with ESMTP id 60F074003A for ; Wed, 8 Jun 2022 01:00:40 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id i1so16272099plg.7 for ; Tue, 07 Jun 2022 18:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5FZ+sLUYy9OHkPNQ2UOiRP0FcNp6Gk5OQExuxjy/G8g=; b=Pnxyox+o0BJ5qgtngPpezfOCV5bi9TzCdhBbuG34EWuhX2N6Dzakkepy0Clk42eZeu yIQwTea+jYxWBCJjS61PQsfpfaic/zqRdHYoVejmQffVu2LTYX9W0hnj2qX4ZXYr33Dj IuTzBqU3P2rKCM86cgGUsQZY3MADyTprtIH9dTvI8Lk55NsQrzWEOW2ZSubtrep+r+Bv 52TlEdi5c9d0/dTas41YiMO8HSn7rFvLDNYaCJ3h1djxiqtb1dh9V6c6h174m/BRAe+Y +lAtrYbBmhSOf/8RO/ZX07FNaRPfYVfbnl9OcaOj/qnOYMshdX5o3384Ma5U7bqcYs2p 9PHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5FZ+sLUYy9OHkPNQ2UOiRP0FcNp6Gk5OQExuxjy/G8g=; b=hm8BAEjnUQRay62aMyoUWixV5MRWMinY3ad3IMNX+Ml88eA3W49sGZFgnAx0UolA3Q Nem+jt0unGggPCWKoLyzMG51aTwXOnCQdvDkc1lbfyoI89G74A1/nc4A7+RJQzYYfZQH Aqq0cthsxoky/ka1SqFI0uTF3kLISo143FHY8rDtRYYFmwSzaCWTvcZTYJ3bPDE6mw3/ e5KvxtVng7N0BkwmOwyarL7NwaYGC9JkDiaQlnf3asmCkTEEDBjYfoEWYzvcQxwS8/EG gTsgt78RYEaMLj5XgMsfw4qt//TSEWdFX8xdYyiDcC2U4Xb0Qx8KnCUIJZ19FF9NRY+4 uxyQ== X-Gm-Message-State: AOAM53185PIMZyF3qGUR2RuiJ3+XTIxWir5l0cdEVFMqbGngOrO5RixH 198lTVi+VykoQ70YMNgINux/hUKMV/gRGPy6uDw= X-Google-Smtp-Source: ABdhPJwTRP53Tm30KioWHOkOpqxgQJCe++7YMcJ3ry7USW+BoYLcslL7AaMg3xZugyZQAZXYHktWL3s9b8UKdKkKaoc= X-Received: by 2002:a17:90a:ce84:b0:1e4:d803:fad with SMTP id g4-20020a17090ace8400b001e4d8030fadmr40731270pju.99.1654650039236; Tue, 07 Jun 2022 18:00:39 -0700 (PDT) MIME-Version: 1.0 References: <20220604004004.954674-4-zokeefe@google.com> <202206060911.I8rRqGwC-lkp@intel.com> <20220606152333.6f06f2e23a1161e444fa0f8d@linux-foundation.org> In-Reply-To: From: Yang Shi Date: Tue, 7 Jun 2022 18:00:26 -0700 Message-ID: Subject: Re: [PATCH v6 03/15] mm/khugepaged: add struct collapse_control To: "Zach O'Keefe" Cc: Andrew Morton , kernel test robot , Alex Shi , David Hildenbrand , David Rientjes , Matthew Wilcox , Michal Hocko , Pasha Tatashin , Peter Xu , Rongwei Wang , SeongJae Park , Song Liu , Vlastimil Babka , Zi Yan , Linux MM , kbuild-all@lists.01.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 Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: t936upiudfn1osxhtzaiqgr3uk7b1opa Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Pnxyox+o; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of shy828301@gmail.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 60F074003A X-HE-Tag: 1654650040-142780 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 Tue, Jun 7, 2022 at 5:43 PM Zach O'Keefe wrote: > > On Mon, Jun 6, 2022 at 4:54 PM Yang Shi wrote: > > > > On Mon, Jun 6, 2022 at 3:23 PM Andrew Morton wrote: > > > > > > On Mon, 6 Jun 2022 09:40:20 -0700 "Zach O'Keefe" wrote: > > > > > > > On Sun, Jun 5, 2022 at 7:42 PM kernel test robot wrote: > > > > > > > > > > Hi Zach, > > > > > > > > > > Thank you for the patch! Perhaps something to improve: > > > > > > > > > > [auto build test WARNING on akpm-mm/mm-everything] > > > > > > > > > > url: https://github.com/intel-lab-lkp/linux/commits/Zach-O-Keefe/mm-userspace-hugepage-collapse/20220606-012953 > > > > > base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything > > > > > config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20220606/202206060911.I8rRqGwC-lkp@intel.com/config) > > > > > compiler: gcc-11 (Debian 11.3.0-1) 11.3.0 > > > > > reproduce (this is a W=1 build): > > > > > # https://github.com/intel-lab-lkp/linux/commit/d87b6065d6050b89930cca0814921aca7c269286 > > > > > git remote add linux-review https://github.com/intel-lab-lkp/linux > > > > > git fetch --no-tags linux-review Zach-O-Keefe/mm-userspace-hugepage-collapse/20220606-012953 > > > > > git checkout d87b6065d6050b89930cca0814921aca7c269286 > > > > > # save the config file > > > > > mkdir build_dir && cp config build_dir/.config > > > > > make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash > > > > > > > > > > If you fix the issue, kindly add following tag where applicable > > > > > Reported-by: kernel test robot > > > > > > > > > > All warnings (new ones prefixed by >>): > > > > > > > > > > mm/khugepaged.c: In function 'khugepaged': > > > > > >> mm/khugepaged.c:2284:1: warning: the frame size of 4160 bytes is larger than 2048 bytes [-Wframe-larger-than=] > > > > > 2284 | } > > > > > | ^ > > > > > > > > Thanks lkp@intel.com. > > > > > > > > This is due to config with: > > > > > > > > CONFIG_FRAME_WARN=2048 > > > > CONFIG_NODES_SHIFT=10 > > > > > > > > Where struct collapse_control has a member int > > > > node_load[MAX_NUMNODES], and we stack allocate one. > > > > > > > > Is this a configuration that needs to be supported? 1024 nodes seems > > > > like a lot and I'm not sure if these configs are randomly generated or > > > > are reminiscent of real systems. > > > > > > Adding 4k to the stack isn't a good thing to do. It's trivial to > > > kmalloc the thing, so why not do that? > > > > Thanks, Andrew. Yeah, I just suggested that too. > > Thanks Yang / Andrew for taking the time to voice your suggestions. > > I'll go ahead and just kmalloc() the thing and fail if we can't. > > Yang, is there a reason to kmalloc() the entire struct > collapse_control with trailing flex array vs stack allocating the > struct collapse_control + kmalloc()'ing the node_load array? I don't think those two have too much difference. I don't have a strong preference personally. However you could choose: Define collapse_control as: struct collapse_control { xxx; ... int node_load[MAX_NUMANODES]; } Then you could kmalloc the whole struct. Or it could be defined as: struct collapse_control { xxx; ... int *node_load[]; } In this way you could allocate collapse_control on stack or by kmalloc, then kmalloc node_load for all possible nodes instead of MAX_NUMANODES. This may have a better success rate since you do kmalloc much less memory (typically the number of possible nodes is much less than MAX_NUMANODES), but it may be not worth it since the error handling path is more complicated and it may not make too much difference. The first choice is definitely much simpler, you may want to try that first. > > > > > > > > I'll await some reviewer input (hopefully positive ;)) before merging > > > this series.