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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 AD5CAC4741F for ; Fri, 6 Nov 2020 07:07:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E22C9208FE for ; Fri, 6 Nov 2020 07:07:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E22C9208FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BE1016B005D; Fri, 6 Nov 2020 02:07:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B68EB6B006C; Fri, 6 Nov 2020 02:07:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A30FE6B006E; Fri, 6 Nov 2020 02:07:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id 73F1C6B005D for ; Fri, 6 Nov 2020 02:07:03 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 14E4B8249980 for ; Fri, 6 Nov 2020 07:07:03 +0000 (UTC) X-FDA: 77453111526.07.pie24_450d4c4272d0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id EAF4A1803FFD1 for ; Fri, 6 Nov 2020 07:07:02 +0000 (UTC) X-HE-Tag: pie24_450d4c4272d0 X-Filterd-Recvd-Size: 5524 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Nov 2020 07:07:00 +0000 (UTC) IronPort-SDR: 1ZaRwdiuahMSVCAkCy0gFgF5R06BTrOnS4jRn++5KErItYUhPB5f1yIi5Phlt3UiXC7insz0b1 Xu0OpTTF/E/g== X-IronPort-AV: E=McAfee;i="6000,8403,9796"; a="166920869" X-IronPort-AV: E=Sophos;i="5.77,455,1596524400"; d="scan'208";a="166920869" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2020 23:06:59 -0800 IronPort-SDR: Tqs3Igj9aFSu78o2eV3CEG5Qrl7tkXtBTj7kOv6uEDJBbkwdv4hmpHbWCKYYI6ANwgorq2xg6y sFRXkptN3f9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,455,1596524400"; d="scan'208";a="528243897" Received: from shbuild999.sh.intel.com (HELO localhost) ([10.239.147.98]) by fmsmga006.fm.intel.com with ESMTP; 05 Nov 2020 23:06:57 -0800 Date: Fri, 6 Nov 2020 15:06:56 +0800 From: Feng Tang To: Michal Hocko Cc: Vlastimil Babka , Andrew Morton , Johannes Weiner , Matthew Wilcox , Mel Gorman , dave.hansen@intel.com, ying.huang@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 0/2] mm: fix OOMs for binding workloads to movable zone only node Message-ID: <20201106070656.GA129085@shbuild999.sh.intel.com> References: <20201104084021.GB15700@shbuild999.sh.intel.com> <20201104085343.GA18718@dhcp22.suse.cz> <20201105014028.GA86777@shbuild999.sh.intel.com> <20201105120818.GC21348@dhcp22.suse.cz> <4029c079-b1f3-f290-26b6-a819c52f5200@suse.cz> <20201105125828.GG21348@dhcp22.suse.cz> <20201105130710.GB16525@shbuild999.sh.intel.com> <20201105131245.GH21348@dhcp22.suse.cz> <20201105134305.GA16424@shbuild999.sh.intel.com> <20201105161612.GM21348@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201105161612.GM21348@dhcp22.suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) 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 Thu, Nov 05, 2020 at 05:16:12PM +0100, Michal Hocko wrote: > On Thu 05-11-20 21:43:05, Feng Tang wrote: > > On Thu, Nov 05, 2020 at 02:12:45PM +0100, Michal Hocko wrote: > > > On Thu 05-11-20 21:07:10, Feng Tang wrote: > > > [...] > > > > My debug traces shows it is, and its gfp_mask is 'GFP_KERNEL' > > > > > > Can you provide the full information please? Which node has been > > > requested. Which cpuset the calling process run in and which node has > > > the allocation succeeded from? A bare dump_stack without any further > > > context is not really helpful. > > > > I don't have the same platform as the original report, so I simulated > > one similar setup (with fakenuma and movablecore), which has 2 memory > > nodes: node 0 has DMA0/DMA32/Movable zones, while node 1 has only > > Movable zone. With it, I can got the same error and same oom callstack > > as the original report (as in the cover-letter). > > > > The test command is: > > # docker run -it --rm --cpuset-mems 1 ubuntu:latest bash -c "grep Mems_allowed /proc/self/status" > > > > To debug I only added some trace in the __alloc_pages_nodemask(), and > > for the callstack which get the page successfully: > > > > [ 567.510903] Call Trace: > > [ 567.510909] dump_stack+0x74/0x9a > > [ 567.510910] __alloc_pages_nodemask.cold+0x22/0xe5 > > [ 567.510913] alloc_pages_current+0x87/0xe0 > > [ 567.510914] __vmalloc_node_range+0x14c/0x240 > > [ 567.510918] module_alloc+0x82/0xe0 > > [ 567.510921] bpf_jit_alloc_exec+0xe/0x10 > > [ 567.510922] bpf_jit_binary_alloc+0x7a/0x120 > > [ 567.510925] bpf_int_jit_compile+0x145/0x424 > > [ 567.510926] bpf_prog_select_runtime+0xac/0x130 > > As already said this doesn't really tell much without the additional > information. > > > The incomming parameter nodemask is NULL, and the function will first try the > > cpuset nodemask (1 here), and the zoneidx is only granted 2, which makes the > > 'ac's preferred zone to be NULL. so it goes into __alloc_pages_slowpath(), > > which will first set the nodemask to 'NULL', and this time it got a preferred > > zone: zone DMA32 from node 0, following get_page_from_freelist will allocate > > one page from that zone. > > I do not follow. Both hot and slow paths of the allocator set > ALLOC_CPUSET or emulate it by mems_allowed when cpusets are nebaled > IIRC. This is later enforced in get_page_from_free_list. There are some > exceptions when the allocating process can run away from its cpusets - > e.g. IRQs, OOM victims and few other cases but definitely not a random > allocation. There might be some subtle details that have changed or I > might have forgot but yes, I was confused too. IIUC, the key check inside get_page_from_freelist() is if (cpusets_enabled() && (alloc_flags & ALLOC_CPUSET) && !__cpuset_zone_allowed(zone, gfp_mask)) In our case (kernel page got allocated), the first 2 conditions are true, and for __cpuset_zone_allowed(), the possible place to return true is checking parent cpuset's nodemask cs = nearest_hardwall_ancestor(task_cs(current)); allowed = node_isset(node, cs->mems_allowed); This will override the ALLOC_CPUSET check. Thanks, Feng > -- > Michal Hocko > SUSE Labs