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 349FCC433EF for ; Mon, 6 Jun 2022 21:22:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 852D76B0073; Mon, 6 Jun 2022 17:22:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 802566B0075; Mon, 6 Jun 2022 17:22:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A2BD6B0078; Mon, 6 Jun 2022 17:22:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5905F6B0073 for ; Mon, 6 Jun 2022 17:22:55 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2783D35073 for ; Mon, 6 Jun 2022 21:22:55 +0000 (UTC) X-FDA: 79549085910.03.5F2712A Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by imf07.hostedemail.com (Postfix) with ESMTP id 939D240017 for ; Mon, 6 Jun 2022 21:22:40 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id 129so13993572pgc.2 for ; Mon, 06 Jun 2022 14:22:54 -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=asaZKjuyA7ena57q1SwQkrrRw706iL2KylYyzT65oAY=; b=f1u+oPmVlKdSpSjUoUeoyaK0LSDJ9Hf8qJRVZxxKX6rTQK+bSQLEBuLnSXcVU/SAIQ x1MSO+AeKNWqZrXOxWetCOP9d+9djXDIr2Ut0gas+8YisWyjKiEVENL555ivoRWpaVi0 g0A2F+ewli/yqWrZ37IPFKM3v/VC6nXZRGI9GHr/V6xUD7llLdfkFOUPEvQwxbBeJFLj +BVZG7lkGZuZWKyl4rqKqdgOmJR3GqDlTRGLLDrfAfYvMs1bEyRc0GA3c3my4OJgAvbh 1YSS4MmauIm+A6iAZDCNo91RwWzK/MNoy3yNl6h7eKZLHIfx1D2p8W2vQZjStLK+nvIm bwng== 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=asaZKjuyA7ena57q1SwQkrrRw706iL2KylYyzT65oAY=; b=NuXoz51eKzPyT2tSA6/Wpwdy1W5BdYfsmcwJ/efdEDcwsGhTA5BeVsEYGCMpQGrTNn bfRiY8QMlD6N+7Kt9DFhN2BrqQgRoHlXS68QWyTiiv2jyHyojFKZOs0SCBNOAP7+mEZG qV+FBWg0L9Ub15isEhYXZw8USLvCgC8fsy2KoLnLAteveQ2Ek63Y8Yr9Yhcj/tRPNh3U l+RDgDtMRq4JT0PxESL7/q3YQtbUosIaf2JVvztX9SQrAwqLZ9Ag0OOpY9gaUi3Ergne 4eRtI4SdZHvuZTXpRjuwywD4v7mXsgmXTU+K/WEOiDFnynEDVxFOMO1+mqNcpm3IMXcK cBAA== X-Gm-Message-State: AOAM5320EmmzmJPqygmsOGc9kxMq8FiRKEoBVgSW44IDWmIw3H/cvals KLDKFarT1SeS80NeaPzw76/rDoJ6hPlcgkG+A5Q= X-Google-Smtp-Source: ABdhPJxcjqrNL+dWcyyIHTYhRD2aGYaKy69A3LieIApNYzYZ9SNVm36/OeTJQ85GwnKRYyEukFbWBrKeqos4tnuTO0c= X-Received: by 2002:a65:67c1:0:b0:3fd:ebd6:5dab with SMTP id b1-20020a6567c1000000b003fdebd65dabmr2414675pgs.75.1654550573617; Mon, 06 Jun 2022 14:22:53 -0700 (PDT) MIME-Version: 1.0 References: <20220604004004.954674-4-zokeefe@google.com> <202206060911.I8rRqGwC-lkp@intel.com> In-Reply-To: From: Yang Shi Date: Mon, 6 Jun 2022 14:22:41 -0700 Message-ID: Subject: Re: [PATCH v6 03/15] mm/khugepaged: add struct collapse_control To: "Zach O'Keefe" Cc: 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 , Andrew Morton , 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-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 939D240017 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=f1u+oPmV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of shy828301@gmail.com designates 209.85.215.171 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Stat-Signature: nufsqymgpcfm31dyx97prbjydzq5r7nq X-Rspam-User: X-HE-Tag: 1654550560-798034 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 Mon, Jun 6, 2022 at 1:20 PM Yang Shi wrote: > > On Mon, Jun 6, 2022 at 9:40 AM 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. > > I don't have a better idea other than moving it out of the > collapse_control struct. You may consider changing node_load to two > dimensions, for example: > > node_load[2][MAX_NUMNODES], then define: > enum { > /* khugepaged */ > COLLAPSE_ASYNC, > /* MADV_COLLAPSE */ > COLLAPSE_SYNC > } > > Then khugepaged and MADV_COLLAPSE get their dedicated node_load respectively. Sorry, I just realized this won't work for MADV_COLLAPSE since multiple processes may call it at the same time. We may consider allocating it dynamically. Have node_load the last element of collapse_control struct, then do: for_each_node(node) kmalloc(sizeof(int), GFP_KERNEL); MADV_COLLAPSE or khugepaged could just fail if it fails since THP allocation is unlikely to succeed in this case. But not sure if it is worth the complexity rather than just killing it. > > The more aggressive approach may be just killing node_load, but I'm > not sure what impact it may incur. > > > > > Thanks, > > Zach > > > > > > > > vim +2284 mm/khugepaged.c > > > > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2261 > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2262 static int khugepaged(void *none) > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2263 { > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2264 struct mm_slot *mm_slot; > > > d87b6065d6050b Zach O'Keefe 2022-06-03 2265 struct collapse_control cc = { > > > d87b6065d6050b Zach O'Keefe 2022-06-03 2266 .last_target_node = NUMA_NO_NODE, > > > d87b6065d6050b Zach O'Keefe 2022-06-03 2267 }; > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2268 > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2269 set_freezable(); > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2270 set_user_nice(current, MAX_NICE); > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2271 > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2272 while (!kthread_should_stop()) { > > > d87b6065d6050b Zach O'Keefe 2022-06-03 2273 khugepaged_do_scan(&cc); > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2274 khugepaged_wait_work(); > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2275 } > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2276 > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2277 spin_lock(&khugepaged_mm_lock); > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2278 mm_slot = khugepaged_scan.mm_slot; > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2279 khugepaged_scan.mm_slot = NULL; > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2280 if (mm_slot) > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2281 collect_mm_slot(mm_slot); > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2282 spin_unlock(&khugepaged_mm_lock); > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2283 return 0; > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 @2284 } > > > b46e756f5e4703 Kirill A. Shutemov 2016-07-26 2285 > > > > > > -- > > > 0-DAY CI Kernel Test Service > > > https://01.org/lkp > > >