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 08D41C61DA4 for ; Thu, 16 Feb 2023 10:51:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74E746B0071; Thu, 16 Feb 2023 05:51:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D7216B0072; Thu, 16 Feb 2023 05:51:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 551236B0073; Thu, 16 Feb 2023 05:51:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 41DE16B0071 for ; Thu, 16 Feb 2023 05:51:11 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0A0C31C6B15 for ; Thu, 16 Feb 2023 10:51:11 +0000 (UTC) X-FDA: 80472837942.11.A64856B Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf30.hostedemail.com (Postfix) with ESMTP id C09828001B for ; Thu, 16 Feb 2023 10:51:07 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=El23xDo4; spf=pass (imf30.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676544669; 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=nChoiqV2yK6Jy1ylzJ1lVYh06ZMHX2KGT08aNMbO+f0=; b=2EvHhkWtdU7z2JgwhvleGJXXLy//KFqSq+PRU7x4fdAXJ2IOYK3dB3zMN8GrNSS6BrCczt 2kNeYkk6t7RUOSCW/Ul5U1lqncAqmIG0mm424jRc7zV9fZ/nxDuaVqSTWiuHnsX+MSUUma pl/rKEpAMY17yM9O6dndJ5wP/XHoXaY= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=El23xDo4; spf=pass (imf30.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676544669; a=rsa-sha256; cv=none; b=bGsif7lDBho/+CprPgTMoL+B3hya7KW7f94hliFkSGv7gDFyEjw/YKOOWbyzR2WCONdBg7 P6Z06FVhaGxiZn4wRR+IElIsNhDhUJxisPItUarM6sKUqpAze0qFfHudCRB55v5WA+NXEW 3OpQg9KN6UPUf3u0r4bz7zUxZWZtYqo= Received: by mail-pj1-f41.google.com with SMTP id oa11-20020a17090b1bcb00b002341a2656e5so1754783pjb.1 for ; Thu, 16 Feb 2023 02:51:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=nChoiqV2yK6Jy1ylzJ1lVYh06ZMHX2KGT08aNMbO+f0=; b=El23xDo4oC8g7+TXtctCcEVoB+mx01JYv93T1FrJMjLYZv4QVl6faN4AiG5cgmhFO+ NryvTNV/tWkKNNnZ/J1d983Ql/MdTbxU7ANNPSstQBbD565OAAe3Ptxa8covwK0kmKrG Wwyob8wtPuRPCoBZXYw3lOdJK/trhSlltZZ6uPe6LaIz5CsoVAmE6h4Aoe+eiNIv3MFP TlIfFXLVo8NPPig5zIv+8VXf/fba9BoH3l4jU9LRWtd2nLu2bDW0VOwippdrnI4OkWTN cr2BX4vli0syKH1XPJQgz5N5ZJL/23CTBsx+IdNS1Onh4m3G6mRiZzAhwpHf346rJL/t npkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nChoiqV2yK6Jy1ylzJ1lVYh06ZMHX2KGT08aNMbO+f0=; b=Prp2I5p4SZwozSn/Y+NrM6upu4e3GPayo1KLLEnvLj2MkzlifosaLZuCHO/+Gf00RY bLLR5UdKtMPD3D2h5jnTftcKHRMzXYD5b+kegicJPaOXfrfx3BW4JSf4n/vX2epeVjo5 eXIFbWTBRpbuJ7w7UGXIkL104RGD1vSo0fJeOPSUAg3K25UjnkCWbjWAixWzyALr7vrG qc0LpZJ61pXXbbggmL9aPOBCk8BTxNt5CfPv5aWhylPC+3e//klMWeyGTEi7Sph+PRWv NjYcV7uEXiy94RknQSVr9xKGxPSiBF0GhV+9FxJQh4mVmLbNdbUaLItS485aGIaNFe14 6mJQ== X-Gm-Message-State: AO0yUKVoafvdkE/jm5BdsPqS03jk46KQ5gbDM08k3/aHw0/KzYstZEF/ C6Fd3HvyxJpBcuHPZ8MwNz0uow== X-Google-Smtp-Source: AK7set+SRcz2gDYqS5ySRJL78XzF8sO3NZKUxaITPWdZl8H3wOGhPfc1ttGmSgfIRcP5FGtkdRLyEw== X-Received: by 2002:a17:902:e5ce:b0:19a:f556:e386 with SMTP id u14-20020a170902e5ce00b0019af556e386mr1186100plf.0.1676544666218; Thu, 16 Feb 2023 02:51:06 -0800 (PST) Received: from [10.70.252.135] ([139.177.225.229]) by smtp.gmail.com with ESMTPSA id l11-20020a170902d34b00b0019ac69a6348sm1025261plk.133.2023.02.16.02.50.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Feb 2023 02:51:05 -0800 (PST) Message-ID: Date: Thu, 16 Feb 2023 18:50:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: Re: [PATCH 0/2] handle memoryless nodes more appropriately To: Michal Hocko Cc: akpm@linux-foundation.org, vbabka@suse.cz, david@redhat.com, rppt@kernel.org, willy@infradead.org, mgorman@techsingularity.net, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song References: <20230215152412.13368-1-zhengqi.arch@bytedance.com> <3426457c-99bf-9f7c-f663-c29474d9fa73@bytedance.com> <767893ef-f8c2-c478-f1a0-e785bbf2da09@bytedance.com> Content-Language: en-US From: Qi Zheng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Stat-Signature: ydx9fpyibyp677k33fkcmxoeuaq9qggm X-Rspam-User: X-Rspamd-Queue-Id: C09828001B X-Rspamd-Server: rspam06 X-HE-Tag: 1676544667-426850 X-HE-Meta: U2FsdGVkX1/0HYrldBXYGRfCjJjwXFP9nFMAjcGq9ZB//Kk8IYvmcl7JPdm6hoiCzT306TSii/tJ8EkLeUqMhF3W6Ytmba4csZA9c0RJg8Z2ghR2h4tbCtNah09u3QUJvfDmHUL9x0cFGBWqS+KFRfneDbzPgtyLJW7yTB6UuJ8X3ytI4nueW7TVox8vH6M9ChcJU+l8V/Pj1V/8EPYAUD8mWMyxLxqPaGLH2WhZBdy9eT4GorKM4gDVxnMMPwQnwoC9llSR4Hpgj5ras9AETEvycWGAdEKnkjKrxAK15+0OXPU6essC+uXSLP40sLqultunTDIMq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WYQ60VONh2oomXV7JXfWhIb5qVVIei9 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 2023/2/16 16:37, Michal Hocko wrote: > On Thu 16-02-23 16:21:54, Qi Zheng wrote: >> >> >> On 2023/2/16 15:51, Michal Hocko wrote: >>> On Thu 16-02-23 07:11:19, Qi Zheng wrote: >>>> >>>> >>>> On 2023/2/16 00:36, Michal Hocko wrote: >>>>> On Wed 15-02-23 23:24:10, Qi Zheng wrote: >>>>>> Hi all, >>>>>> >>>>>> Currently, in the process of initialization or offline memory, memoryless >>>>>> nodes will still be built into the fallback list of itself or other nodes. >>>>>> >>>>>> This is not what we expected, so this patch series removes memoryless >>>>>> nodes from the fallback list entirely. >>>>>> >>>>>> Comments and suggestions are welcome. >>>> >>>> Hi Michal, >>>> >>>>> >>>>> This is a tricky area full of surprises and it is really easy to >>>> >>>> Would you mind giving an example of a "new problem"? >>> >>> The initialization is spread over several places and it is quite easy to >>> introduce bugs because it is hard to review this area. Been there done >>> that. Just look into the git log. >> >> I understand your concern, but should we therefore reject all revisions >> to this? > > No, but either somebode is willing to invest a non-trivial amount of > time and unify the NUMA initialization code that is spread over arch > specific code in different places or we should just focus on addressing > bugs. > >>>>> introduce new problems. What kind of problem/issue are you trying to >>>>> solve/handle by these changes? >>>> >>>> IIUC, I think there are two reasons: >>>> >>>> Firstly, as mentioned in commit message, the memoryless node has no >>>> memory to allocate (If it can be allocated, it may also cause the panic >>>> I mentioned in [1]), so we should not continue to traverse it when >>>> allocating memory at runtime, which will have a certain overhead. >>> >>> Sure that is not the most optimal implementation but does this matter in >>> practice? Can you observe any actual measurable performance penalty? >> >> No, and the original reason for noticing this place was the panic I >> mentioned in [1] (< NODE_MIN_SIZE). And if we had handled the memoryless >> node's zonelist correctly before, we wouldn't have had that panic at >> all. > > Yes, this is another good example of how subtle the code is. Mike has > posted a patch that simply drops the NODE_MIN_SIZE constrain and I > believe that is the right thing to do at this stage. There is a non-zero > risk of regression but at least we will be forced to fix the original > problem properly or at least document is properly. > >>> Currently we are just sacrificing some tiny performance for a >>> simplicity. >> Hmm, I don't think my modification complicates the code. >> >>>> Secondly, from the perspective of semantic correctness, why do we remove >>>> the memoryless node from the fallback list of other normal nodes >>>> (N_MEMORY), but not from its own fallback list (PATCH[1/2])? Why should >>>> an upcoming memoryless node continue exist in the fallback list of >>>> itself and other normal nodes (PATCH[2/2])? >>> >>> I am not sure I follow. What is the semantic correctness issue? >> >> Sorry for the ambiguity, what I meant was that memoryless nodes should >> never have been built into any fallback list, not just for performance >> optimizations. > > Well, I am not 100% sure I agree with you here. The performance would be > the only reason why to drop those nodes from zonelists. Other than that > zonelists are a useful abstraction for the node distance ordering. Even > if those nodes do not have any memory at all in principle there is no > big difference from depleted nodes. I see what you mean, no more code for no more bugs (in cases where is no obvious gain). But I still feel that the current implementation is rather weird (deleted some, and kept some), and my changes are actually very small. Anyway, let's wait for other people's opinions. :) -- Thanks, Qi