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 81E80C28D13 for ; Mon, 22 Aug 2022 07:00:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6DE4940009; Mon, 22 Aug 2022 03:00:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1D89940007; Mon, 22 Aug 2022 03:00:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E85B940009; Mon, 22 Aug 2022 03:00:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 90ABE940007 for ; Mon, 22 Aug 2022 03:00:37 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5B6ABA0843 for ; Mon, 22 Aug 2022 07:00:37 +0000 (UTC) X-FDA: 79826330514.18.E50F218 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf29.hostedemail.com (Postfix) with ESMTP id D9063120081 for ; Mon, 22 Aug 2022 07:00:35 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1258D5C869; Mon, 22 Aug 2022 07:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661151634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+5FqNMURrzSr65e1qd0Drb+fJqBgQJf99xfHlmHtTTg=; b=XcZ9XpuJEuCXQcr83vTsHnJytYeZiKe/7Ek4mPrLg4ix9YljzfvrRCSD2FQ0K6DdAm0c6h Qku+UVgdTbHckFPKxlf/H0yBH8QVQtfNrpZ80TB0Rf8E4qTN5kIIvXc9V6nurvzY1lp/4J bc8xlLQ+fJ0kEaypLV6Irsr3VThepCI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661151634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+5FqNMURrzSr65e1qd0Drb+fJqBgQJf99xfHlmHtTTg=; b=jalAuDnSXzGnvJgbSmpBBo26JP4ei8CB3TIGFlHQj9rk/RM2yKCNEbv2LjbigQTh4nYmnp 3drJZKSxSKLtF1AA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D3F4113523; Mon, 22 Aug 2022 07:00:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id O3j2MpEpA2NoFgAAMHmgww (envelope-from ); Mon, 22 Aug 2022 07:00:33 +0000 Message-ID: Date: Mon, 22 Aug 2022 09:00:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.0 Subject: Re: [PATCH] page_ext: move up page_ext_init() to catch early page allocation if DEFERRED_STRUCT_PAGE_INIT is n To: lizhe.67@bytedance.com, mhocko@suse.com Cc: Jason@zx2c4.com, akpm@linux-foundation.org, keescook@chromium.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lizefan.x@bytedance.com, mark-pk.tsai@mediatek.com, mhiramat@kernel.org, rostedt@goodmis.org, yuanzhu@bytedance.com References: <20220820010257.11488-1-lizhe.67@bytedance.com> Content-Language: en-US From: Vlastimil Babka In-Reply-To: <20220820010257.11488-1-lizhe.67@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661151636; a=rsa-sha256; cv=none; b=LEAMulT852iWpiUztKVvvB3MSkjFBgso+MswfdLG9aAbVYB9/cuoMpSdZVRowW5yM5iytH BZk9zJJs5+xrY0VQm5YtSnfI8LgL4lpw39/GXPTLcfcdWtOAqLC9LbpbIsxgG+ezcOzY5J NkEMY2cOVq2aR5eB/kGtL4/YvFWCh8c= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=XcZ9XpuJ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=jalAuDnS; dmarc=none; spf=pass (imf29.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661151636; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+5FqNMURrzSr65e1qd0Drb+fJqBgQJf99xfHlmHtTTg=; b=UyOMkbB84kz7tmnUUGvEIFjWcA2gpWjp4pKt7huOuRFsu+8FoXqPqrbDCVjTNekFBq/Ece q0HM7jFtXAigE3AEK13iB/qMT9b25OUCfqkHywBDHWPN7jpFPku7vfOoOwZYLiwZA1/UKk 33p1HmAz/d+mxbID0lkRcdyOii3Qil0= X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: D9063120081 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=XcZ9XpuJ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=jalAuDnS; dmarc=none; spf=pass (imf29.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Stat-Signature: 4kbf8jenbuuby1pm8p9m7fx8ozqteoy4 X-Rspam-User: X-HE-Tag: 1661151635-662868 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 8/20/22 03:02, lizhe.67@bytedance.com wrote: > On 2022-08-18 7:36 UTC, mhocko@suse.com wrote: >>> From: Li Zhe >>> >>> In 'commit 2f1ee0913ce5 ("Revert "mm: use early_pfn_to_nid in page_ext_init"")', >>> we call page_ext_init() after page_alloc_init_late() to avoid some panic >>> problem. It seems that we cannot track early page allocations in current >>> kernel even if page structure has been initialized early. >>> >>> This patch move up page_ext_init() to catch early page allocations when >>> DEFERRED_STRUCT_PAGE_INIT is n. After this patch, we only need to turn >>> DEFERRED_STRUCT_PAGE_INIT to n then we are able to analyze the early page >>> allocations. This is useful especially when we find that the free memory >>> value is not the same right after different kernel booting. >> >>is this actually useful in practice? I mean who is going to disable >>DEFERRED_STRUCT_PAGE_INIT and recompile the kernel for debugging early >>allocations? > > Yes it is useful. We use this method to catch the difference of early > page allocations between two kernel. > >> I do see how debugging those early allocations might be useful but that >> would require a boot time option to be practical IMHO. Would it make >> sense to add a early_page_ext parameter which would essentially disable >> the deferred ipage initialization. That should be quite trivial to >> achieve (just hook into defer_init AFAICS). > > It is a good idea. A cmdline parameter is a flexible and dynamic method for > us to decide whether to defer page's and page_ext's initilization. For > comparison, this patch provides a static method to decide whether to defer > page's and page_ext's initilization. They are not conflicting. My next > work is trying to achieve your idea. As we already have to pass page_owner=on parameter to enable the page allocation tracking in the first place, maybe that alone could also disable deffered init, and no need for another parameter? > -- > Li Zhe