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=-3.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 A112EC433E0 for ; Tue, 2 Mar 2021 09:50:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0DE4F64EFC for ; Tue, 2 Mar 2021 09:50:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DE4F64EFC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6D09C8D00F4; Tue, 2 Mar 2021 04:50:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 682078D0063; Tue, 2 Mar 2021 04:50:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 597DE8D00F4; Tue, 2 Mar 2021 04:50:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id 444E38D0063 for ; Tue, 2 Mar 2021 04:50:19 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 13CB4180ACF62 for ; Tue, 2 Mar 2021 09:50:19 +0000 (UTC) X-FDA: 77874463758.30.A65B3A2 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by imf29.hostedemail.com (Postfix) with ESMTP id A687212E for ; Tue, 2 Mar 2021 09:50:17 +0000 (UTC) Received: by mail-pf1-f171.google.com with SMTP id q20so13480174pfu.8 for ; Tue, 02 Mar 2021 01:50:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xtndLsEaN7tzdKD5K+JvWGojXPONwlybi1fJYBg5XAo=; b=rnvConHGygj2YhM2noKk4i8f9KE2eVEJk8eUsStiUtGPjRlsxwwNAk5uBxwRdha7ex BIItuCJDjifrVzkoDGaBpx6O0ycunRZSESsDup7TGLsL/tvOJs2KY7CGLQLmSolxYong wfc0GmfKrRDdW5oh1Zcd4BirHBdVHXij3GmRm+dWUjP+VdZiZJyD3+Rkj+AuVAkxNg4c 7MhsKnYV7NG8cYvePLZJ9g5woJcV1Jqz8AiyzDYxvfbKfniMEKtZol3bLPgenTdzwJry CKXmmLNQDgo6ntiJtDQDUlc8J4GKLU5paTbVDj2V8HTT8W0EUVwGODGvUHVbssLoD0DV E7EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xtndLsEaN7tzdKD5K+JvWGojXPONwlybi1fJYBg5XAo=; b=so65chit+kF4Rag5OZnCuhbLjkLolz6G5bKPeC1nqI8QthGM6MLfYuqsp8VrOfis3x 4XrUb7vh3R7ezVC9kEHnfiImWLms72msjcfb1/gB8GMgZVrtMhVk2/Bsaouy7g0GxyvI rVEAEeWk8FsCcV2olsIeYW1Vr0PDVR1XgjaEtiEY7qzmySaVmLM8urGSaBjEVBYLTLTy 8FF/KHGwIrsN1NA/Zon1qiYap7X7haobxNTtcZ6dmJOkWI3HiRdH8sKzp/tgTx2Qadue RcvD/4kmINb5oGF4v2IOkuV54cvZbNKuCx9gE0Ok34oGQMi/O5jCZxKp9AibTGhmWaNf gJ5Q== X-Gm-Message-State: AOAM532lpGgu++jpmYYLM+p4Ci8cjb6L0xbqntRBgwYQBUkLbmOqlRTW hBEVL/AWn/XTmYK3aZFKCjtDeckd3HM8pUd+/AYNFQ== X-Google-Smtp-Source: ABdhPJyBL4+o7TN0CcugFT0hUMqIrP+PY3j9837YOq+x3Hw/7QAYa8H9G+jv5QvX/cjzNIkRQwaQQXcgTHFBxeGxdIY= X-Received: by 2002:a65:6645:: with SMTP id z5mr17097527pgv.273.1614678616654; Tue, 02 Mar 2021 01:50:16 -0800 (PST) MIME-Version: 1.0 References: <20210302073733.8928-1-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Tue, 2 Mar 2021 17:49:39 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm: memcontrol: fix kernel stack account To: Michal Hocko Cc: Roman Gushchin , Johannes Weiner , Andrew Morton , Shakeel Butt , LKML , Linux Memory Management List Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A687212E X-Stat-Signature: b3syt7mrx466gw5bqyeefmnyr1e1rfc8 Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=mail-pf1-f171.google.com; client-ip=209.85.210.171 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614678617-892170 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 Tue, Mar 2, 2021 at 5:34 PM Michal Hocko wrote: > > On Tue 02-03-21 17:23:42, Muchun Song wrote: > > On Tue, Mar 2, 2021 at 4:44 PM Michal Hocko wrote: > > > > > > On Tue 02-03-21 15:37:33, Muchun Song wrote: > > > > The alloc_thread_stack_node() cannot guarantee that allocated stack pages > > > > are in the same node when CONFIG_VMAP_STACK. Because we do not specify > > > > __GFP_THISNODE to __vmalloc_node_range(). Fix it by caling > > > > mod_lruvec_page_state() for each page one by one. > > > > > > What is the actual problem you are trying to address by this patch? > > > 991e7673859e has deliberately dropped the per page accounting. Can you > > > explain why that was incorrect? There surely is some imprecision > > > involved but does it matter and is it even observable? > > > > When I read the code of account_kernel_stack(), I see a comment that > > says "All stack pages are in the same node". I am confused about this. > > IIUC, there is no guarantee about this. Right? > > Yes there is no guarantee indeed. Please always make sure to describe > the underlying reasoning for the patch. Subject of this patch refers to > a fix without explaining the actual problem. If a change is motivated by > code reading then make it explicit. Also if you are refering to a > different commit by Fixes: tag then it would be really helpful to > explicitly mention why that commit is incorrect or cause a visible > problems. Got it. Thanks for your teaching. > > > Yeah, imprecision may > > not be a problem. But if this is what we did deliberately, I think that > > it is better to add a comment there. Thanks. > > Yes the comment is quite confusing. I suspect it meant to say > /* All stack pages are accounted to the same node */ > > -- > Michal Hocko > SUSE Labs