Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2732418pxb; Tue, 9 Mar 2021 09:29:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJykMEsTDla8U5WNWPg/qCvc7JtvtHHhlm8gkTnAod2il+Dkj1dUwsUGOBhDNBDZimLcSvQy X-Received: by 2002:aa7:c815:: with SMTP id a21mr5505770edt.38.1615310972458; Tue, 09 Mar 2021 09:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615310972; cv=none; d=google.com; s=arc-20160816; b=fXbW2JMeVEAlcR8DpAKRg9R57PrLgroeLWZzj9veUMeCRcR5zY0QVjNALWnpMMdPWt 33nO/UwEqNyx4ZxcvhF9Asr6aK1gJPbtMDR/nBAbVuEEUSQcJJcrRVSIYqfm789fwYf4 jHyi/MtLqASWy86oGgcmRUP5L9+C8ziB+khSWprhktMPvTZS09DzgYDDtO3ntaw6JweH RbNq+kVt+y5kSB+4Xrv3t0PXXwS3Ij5/ShRC5kSCGIOMHIGPeljtq7sM9SKo4q7ZyXFt v3QESRXXsreIBlwDWxbQHRzsft7sUehbMSx7vb0Qk7u5kQORyQylKuTyr+R9lMgPeU/J WIDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=RgCAC8soedBAR4QV6xrwRz7z96hXnQfIsjeHL6pqe5I=; b=AdkzjCRBqXtmdYcyPEZ/+yQAkAPZH0bxzK81lQViYDr/usZBEYmlhZ7+EoJ+nBUYVd znnL5MRZvnOVezxdvZ3XjfhtM0H3VOfJimh4y6ewDi3y8vHGppOTduX8Qrq9Qs4aCTOf 6CPfLb2pDH9fjf/vzHdWOjFdUtdjHQR6TEKB8s/CeGHPiBhi8g/yOi23ttOILtNxl7MW zxntnjZam8/8lI9PDfc2aDZyvR/tNKjNTHRoCaMth712890iDmWYv0tAmtV+2De4LVDZ YjAk+4XFAonwdR8uaaOcwFswMaIGqefBzYmnIgziQ8GBalZ9BcspyOpgtA3gma3HRxuw kzkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=neFB4ap4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jt20si9793331ejb.157.2021.03.09.09.29.09; Tue, 09 Mar 2021 09:29:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=neFB4ap4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231816AbhCIR2P (ORCPT + 99 others); Tue, 9 Mar 2021 12:28:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231646AbhCIR1z (ORCPT ); Tue, 9 Mar 2021 12:27:55 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52581C06174A for ; Tue, 9 Mar 2021 09:27:55 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id w7so3446705pll.8 for ; Tue, 09 Mar 2021 09:27:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RgCAC8soedBAR4QV6xrwRz7z96hXnQfIsjeHL6pqe5I=; b=neFB4ap49LsR/+Ea8ax5epXOkyWa4xXrzFKkoAMpt7upOSctyqk+0Znslr3U5Thf0G UkedV76CyXkyNkUD505gwubYQbvFedbL773bhgVpfauWpGD7Kr52RJeMQhzMzXRN0Or4 HibQ5z3ETpIFtOF3yZUS94v1IVqNO2KGgXePMLGxr8wFNHjNH0pMePO40l5ebSwD5SFB x0KZY231Kqy7GfPBHRwugE1BXgQ8/C0S9GjzmVPDINz2tbsH0wzsQPtGqEfWDij0bTDT T2LLFeHo2v/0oC0NaLt+qlkqUPBQP294Wml1/VhONdDh3j/jGBcfJ+XFiipiX7zHivw7 2zRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=RgCAC8soedBAR4QV6xrwRz7z96hXnQfIsjeHL6pqe5I=; b=TUWKPC2eyrxndbLkw+bYQyowEGP52FrwyyWHMR3RITN1ScRG7p37TkC5C6IiIo6g97 o0DGwkQQSiWr2kMg4DOwj9TPHsNfdhLVkDTWK197OgYZK/TyXRpLhkbh/wOOHaEiZwmw 2EH1X69iiIihXyY3CC/MN0B0FYCQddsTYrtQdl/brsiIIARdY13F4qwZAwlKYb6PB6B3 YEBnfJXPkn3JKosYmF/IZpz/ne4UegU9n18XIkFk/do/jS37PYrlxn9USVsrlRBenogy LIIv152j6xklZ89zyLX3+5a5pIeHtcDczbVEIdbZu7CHDvF/l16ZzNULjsHq+Wb7ZKeF O9wQ== X-Gm-Message-State: AOAM530oKU2MUKqpKCGiTCgbPTGhJgafYDYe+bITGCLQGQi+EzRQGLrq PfJgOTtH0S32n5rkZ8yppY3rGwKNs+Y= X-Received: by 2002:a17:90a:5587:: with SMTP id c7mr5549405pji.5.1615310874689; Tue, 09 Mar 2021 09:27:54 -0800 (PST) Received: from google.com ([2620:15c:211:201:f896:d6be:86d4:a59b]) by smtp.gmail.com with ESMTPSA id e83sm6038999pfh.80.2021.03.09.09.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 09:27:53 -0800 (PST) Sender: Minchan Kim Date: Tue, 9 Mar 2021 09:27:51 -0800 From: Minchan Kim To: Michal Hocko Cc: Andrew Morton , linux-mm , LKML , John Dias , David Hildenbrand , Jason Baron Subject: Re: [PATCH v2] mm: page_alloc: dump migrate-failed pages Message-ID: References: <20210308202047.1903802-1-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 09, 2021 at 05:32:08PM +0100, Michal Hocko wrote: > On Tue 09-03-21 08:15:41, Minchan Kim wrote: > > On Tue, Mar 09, 2021 at 10:32:51AM +0100, Michal Hocko wrote: > > > On Mon 08-03-21 12:20:47, Minchan Kim wrote: > > > > alloc_contig_range is usually used on cma area or movable zone. > > > > It's critical if the page migration fails on those areas so > > > > dump more debugging message. > > > > > > I disagree with this statement. alloc_contig_range is not a reliable > > > allocator. Any user, be it CMA or direct users of alloc_contig_range > > > have to deal with allocation failures. Debugging information can be > > > still useful but considering migration failures critical is > > > overstatement to say the least. > > > > Fair enough. Let's change it. > > > > "Currently, debugging CMA allocation failure is too hard > > due to lacking of page information. alloc_contig_range is > > proper place to dump them since it has migrate-failed page > > list." > > "Currently, debugging CMA allocation failures is quite limited. The most > commong source of these failures seems to be page migration which > doesn't provide any useful information on the reason of the failure by > itself. alloc_contig_range can report those failures as it holds a list > of migrate-failed pages." Will take it. Thanks. < snip > > > > Somebody more familiar with the dynamic debugging infrastructure needs > > > to have a look but from from a quick look it seems ok. > > > > > > Do we really need all the ugly ifdefery, though? Don't we want to have > > > this compiled in all the time and just rely on the static branch managed > > > by the dynamic debugging framework? > > > > I have no further idea to make it simple while we keep the flexibility > > for arguments and print format. > > > > #if defined(CONFIG_DYNAMIC_DEBUG) || \ > > (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE)) > > static void alloc_contig_dump_pages(struct list_head *page_list) > > { > > static DEFINE_RATELIMIT_STATE(_rs, > > DEFAULT_RATELIMIT_INTERVAL, > > DEFAULT_RATELIMIT_BURST); > > > > DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, > > "migrate failure"); > > if (DYNAMIC_DEBUG_BRANCH(descriptor) && __ratelimit(&_rs)) { > > struct page *page; > > > > WARN(1, "failed callstack"); > > list_for_each_entry(page, page_list, lru) > > dump_page(page, "migration failure"); > > } > > } > > #else > > static inline void alloc_contig_dump_pages(struct list_head *page_list) > > { > > } > > #endif > > First, you would be much better off by droping the rate limitting. I am > nt really convinced this is really necessary as this is a debugging aid > enabled on request. A single list can be large enough to swamp logs so > why bother? No problem. Just added since David mentioned hugetlb pages are easily fail to mgirate at this moment. Yes, We could add the ratelimit if we get complain. > > Also are all those CONFIG_DYNAMIC_DEBUG* ifdefs necessary? Can we > simply enable DYNAMIC_DEBUG for page_alloc as I've suggested above? They are different usecases. With DYNAMIC_DEBUG_MODULE with CONFIG_DYNAMIC_DEBUG_CORE, it works for only specific compile flags as you suggested. (CONFIG_DYNAMIC_DEBUG_CORE is requirement to work DYNAMIC_DEBUG_MODULE. With CONFIG_DYNAMIC_DEBUG, user could enable/disable every dynamic debug places without needing DYNAMIC_DEBUG_MODULE flags for source files. Both usecase makes sense to me.