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=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 3D60AC433E6 for ; Wed, 10 Mar 2021 18:15:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E3D9164FB5 for ; Wed, 10 Mar 2021 18:15:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3D9164FB5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 538DF8D01F7; Wed, 10 Mar 2021 13:15:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E8908D01ED; Wed, 10 Mar 2021 13:15:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 389758D01F7; Wed, 10 Mar 2021 13:15:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id 1F6E38D01ED for ; Wed, 10 Mar 2021 13:15:08 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D718C824999B for ; Wed, 10 Mar 2021 18:15:07 +0000 (UTC) X-FDA: 77904766254.22.CF52B93 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf29.hostedemail.com (Postfix) with ESMTP id 205DCF7 for ; Wed, 10 Mar 2021 18:15:03 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id y13so9189322pfr.0 for ; Wed, 10 Mar 2021 10:15:06 -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=Zxiip2c1Jbn1bNQkx0KWERIv1qGU2NgyRSD/41MH1PQ=; b=sWH/DMKMNLZLpIijHk76vZJm0wBKHgHee05dHNVrYaqg4afe2O0sENf3b8h5k8dqqQ eUl6jzWb6id/wwcENgDwVwHFYfIWA9OkVSC4U4u36/BGy4FGRUvgQUyBJgV1rL1tegYl nFdFyHmALWSITuq3H+4HVxRclEmxvABye5qWOzsom1EtvAuN0KjqhjRJz5alwHJIzkEm RXupMVoHoiK5AQZZHj/XiCwhxH4/HFFP4MDsK0f77yKZD6DJaTFl7ecpOxesBHl+0vYR 0tlA5jmXQRSBIhTkdkHjV1c8pfezT8ih2YCASBj+mism15sQxcsAPszgPTyTbz1cylMQ OF2A== 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=Zxiip2c1Jbn1bNQkx0KWERIv1qGU2NgyRSD/41MH1PQ=; b=ndSSeC2CYiIcueECBTrDWqcVQYjt2QphIfc4ozox+2TH8iHzaaickiUW7WJcXq6ojn 9kBkGQiOv+KYT5BPir9MTBcIGuIBHyfrrVHQkjUNU9OFQn2PJNwEqWGctkDUvNX7zvbu vpGm/qN2gag0IO5pS0xr9hr0mHooZFFRgqhAhcwVS6KwonHl80bidB1xKgaN/fdrOu2T Jx/pFJtMNggNfIq4xeKb/sPdCqdTKxiMefoP6YNZD9EtW/h75BFv3JtAOnNjVaXLA4Ea rgrAYAtaylGcjfG4iXcDs9MKKmyTLf1kkniuYEtrZawm2snj/7t0PbeSY7aokc53EeU0 cBaQ== X-Gm-Message-State: AOAM532ppbgRqvP0x1eBWIVKCATx4yXExdAS+x+k0iE5Ak9lVlpGSs71 hKfp0XbroBKIxdf/dVzbAWh5NZ/vIuY= X-Google-Smtp-Source: ABdhPJyhnhncF9bbuxh/qByGIrJSZdLQDYG8wDeZD8q3uMLGvjC1p8zeIuLoR7GeDQr6G3CLDJfkRg== X-Received: by 2002:a63:505d:: with SMTP id q29mr3731904pgl.218.1615399648986; Wed, 10 Mar 2021 10:07:28 -0800 (PST) Received: from google.com ([2620:15c:211:201:64cb:74c7:f2c:e5e0]) by smtp.gmail.com with ESMTPSA id d19sm67477pjs.55.2021.03.10.10.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 10:07:27 -0800 (PST) Date: Wed, 10 Mar 2021 10:07:25 -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: X-Stat-Signature: oodc6fc6akqqb6pitm89nzzcmdtmsmy5 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 205DCF7 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=mail-pf1-f170.google.com; client-ip=209.85.210.170 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615400103-782321 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, Mar 10, 2021 at 09:06:48AM -0800, Minchan Kim wrote: > On Wed, Mar 10, 2021 at 05:46:56PM +0100, Michal Hocko wrote: > > On Wed 10-03-21 08:05:36, Minchan Kim wrote: > > > On Wed, Mar 10, 2021 at 02:07:05PM +0100, Michal Hocko wrote: > > [...] > > > > The is a lot of churn indeed. Have you considered adding $FOO_lglvl > > > > variants for those so that you can use them for your particular case > > > > without affecting most of existing users? Something similar we have > > > > discussed in other email thread regarding lru_add_drain_all? > > > > > > I thought that way but didn't try since it couldn't make them > > > atomic(For example, other printk place in other context will > > > affect by the $FOO_lglvl). > > > > I do not follow. I meant something like the following (likely incomplete > > but you should get an idea). > > Oh, I thought you wanted to override loglevel temporally. > > old_lvl = save_printk_lvl(new level); > dump_page(); > restore_printk_lvl(old_lvl); > > > > > diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h > > index 3468794f83d2..71b402eb8f78 100644 > > --- a/include/linux/page_owner.h > > +++ b/include/linux/page_owner.h > > @@ -14,7 +14,7 @@ extern void __set_page_owner(struct page *page, > > extern void __split_page_owner(struct page *page, unsigned int nr); > > extern void __copy_page_owner(struct page *oldpage, struct page *newpage); > > extern void __set_page_owner_migrate_reason(struct page *page, int reason); > > -extern void __dump_page_owner(struct page *page); > > +extern void __dump_page_owner(struct page *page, const char *loglvl); > > extern void pagetypeinfo_showmixedcount_print(struct seq_file *m, > > pg_data_t *pgdat, struct zone *zone); > > > > @@ -46,10 +46,10 @@ static inline void set_page_owner_migrate_reason(struct page *page, int reason) > > if (static_branch_unlikely(&page_owner_inited)) > > __set_page_owner_migrate_reason(page, reason); > > } > > -static inline void dump_page_owner(struct page *page) > > +static inline void dump_page_owner(struct page *page, const char *loglvl) > > { > > if (static_branch_unlikely(&page_owner_inited)) > > - __dump_page_owner(page); > > + __dump_page_owner(page, loglvl); > > } > > #else > > static inline void reset_page_owner(struct page *page, unsigned int order) > > @@ -69,7 +69,7 @@ static inline void copy_page_owner(struct page *oldpage, struct page *newpage) > > static inline void set_page_owner_migrate_reason(struct page *page, int reason) > > { > > } > > -static inline void dump_page_owner(struct page *page) > > +static inline void dump_page_owner(struct page *page, const char *loglvl) > > { > > } > > #endif /* CONFIG_PAGE_OWNER */ > > diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c > > index 9f8117c7cfdd..1b13135d9916 100644 > > --- a/kernel/stacktrace.c > > +++ b/kernel/stacktrace.c > > @@ -14,6 +14,18 @@ > > #include > > #include > > > > +void __stack_trace_print(const unsigned long *entries, unsigned int nr_entries, > > + int spacesconst, char *loglvl) > > +{ > > + unsigned int i; > > + > > + if (WARN_ON(!entries)) > > + return; > > + > > + for (i = 0; i < nr_entries; i++) > > + printk("%s%*c%pS\n", loglvl, 1 + spaces, ' ', (void *)entries[i]); > > +} > > That's exactly I did with introducing pr_loglevel. I wanted to address > *all places* to use dump_page and stack_trace_print since some folks > might ask me to fix all the broken place all at once. I'm getting tired > with such hassle. > > void dump_page(const char *log_lvl, struct page *page, const char *reason) > { > __dump_page(log_lvl, page, reason); > dump_page_owner(log_lvl, page); > } > EXPORT_SYMBOL(dump_page); Since it's good to have regardless of the patch, I posted next revision with removeing ratelimit and put something more in description to proceed the work. Posted v3 - https://lore.kernel.org/linux-mm/20210310180104.517886-1-minchan@kernel.org/