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=-4.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 57725C433E0 for ; Wed, 10 Mar 2021 23:50:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F244764FCA for ; Wed, 10 Mar 2021 23:50:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F244764FCA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8433B8D0251; Wed, 10 Mar 2021 18:50:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A4998D0250; Wed, 10 Mar 2021 18:50:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F71D8D0251; Wed, 10 Mar 2021 18:50:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 3F5F68D0250 for ; Wed, 10 Mar 2021 18:50:41 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EA8336D99 for ; Wed, 10 Mar 2021 23:50:40 +0000 (UTC) X-FDA: 77905611840.20.A661ECF Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by imf02.hostedemail.com (Postfix) with ESMTP id 3CDAC4080F4B for ; Wed, 10 Mar 2021 23:50:32 +0000 (UTC) Received: by mail-pg1-f178.google.com with SMTP id n9so11512440pgi.7 for ; Wed, 10 Mar 2021 15:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=h9ZagqJLxk4OElhdkNGPVroIsWiFpbxbC5YZRvu24ZA=; b=gxKLX80uK2NO4R2AUw7XDraRQhplZ/rId2VFrO69upXzWsfYtCyiWN0ENOT0ZYEMB+ MFvBKQGqalbJbZ4lzAoyecmPr6kgJXTaaptDA7rbElmrAMbx9ctSkQrhgKQGVejI3S5e nelCpfb4e8JCUEmHtg/RJtufArT/G7WQa7P9OyRfnh+dtAzWASSP+XSpqC7yTveT9xhK J15zO3fi1oYPEqSxSS0LctRiqB7OWTRjtPefpj2aYzQv7mGbiC7YuxdFgh1Sy5RVlwjU afr856u2vsDBd/06dgHiuPjpLJV+yZHjNtWcryO9ejf4m2AMtmB3QGcunyLeZZxueny6 +ZJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=h9ZagqJLxk4OElhdkNGPVroIsWiFpbxbC5YZRvu24ZA=; b=GWJel3Z9XdCrvQiZoww9fa104eL+jpf+a2w7NTPBFKLMn3ttC39o4WRsVrjmMFJjfV LqP08ym7ZUcBqa9MyYt+N9vftdYXZTk43jRnLq6CUw7Hag99hjqCzlRdcx93JFpjG8GO ywghhVL4cpi28tuGEs9Ei613sRJRbk+omw79DRt884Tv1fzZBShJCpmWrCnTwDOAbB+l Zv7xe0DAWtOTB/46TAAiSMvlTwHzSEngTGlmiAxiIiuo6q7ksgeM6LLLSd2TAHGMYKOr r+ZOpJzdmzyF03Nkc7mdnC4Xo/fYKndXgZg9kbGks9AxJa7D/VUC5cxi6GR99F5Y/E9S oyIQ== X-Gm-Message-State: AOAM532dEdOcl91qIW6+6/zrIn85f5+qjLc96SGxarniwzlGwvcOfgBR g2DeUe7lUco6zCJYv7EEzKQ= X-Google-Smtp-Source: ABdhPJzd/+OScYpMEEtLglUJ+pg4TyfFxWjB1JBiNwsQ6WNyIWOFf6f6+UAyNBdKQTQD0O6U9XBsMw== X-Received: by 2002:aa7:9aaa:0:b029:1f3:dd0e:282d with SMTP id x10-20020aa79aaa0000b02901f3dd0e282dmr5110398pfi.38.1615420239493; Wed, 10 Mar 2021 15:50:39 -0800 (PST) Received: from f8ffc2228008.ant.amazon.com ([54.240.193.129]) by smtp.gmail.com with ESMTPSA id z4sm527245pgv.73.2021.03.10.15.50.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Mar 2021 15:50:38 -0800 (PST) Subject: Re: [PATCH v2 1/2] mm/memcg: rename mem_cgroup_split_huge_fixup to split_page_memcg To: Hugh Dickins Cc: Michal Hocko , Zhou Guanghui , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, hannes@cmpxchg.org, kirill.shutemov@linux.intel.com, npiggin@gmail.com, ziy@nvidia.com, wangkefeng.wang@huawei.com, guohanjun@huawei.com, dingtianhong@huawei.com, chenweilong@huawei.com, rui.xiang@huawei.com References: <20210304074053.65527-1-zhouguanghui1@huawei.com> <20210304074053.65527-2-zhouguanghui1@huawei.com> <3ad50842-881f-eb88-a14d-0b6c70ce33d2@gmail.com> From: "Singh, Balbir" Message-ID: Date: Thu, 11 Mar 2021 10:50:31 +1100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Stat-Signature: nh5eihxweybqzt9qy6bm1tr9d1jya4ib X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3CDAC4080F4B Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=mail-pg1-f178.google.com; client-ip=209.85.215.178 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1615420232-556560 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 11/3/21 9:00 am, Hugh Dickins wrote: > On Thu, 11 Mar 2021, Singh, Balbir wrote: >> On 9/3/21 7:28 pm, Michal Hocko wrote: >>> On Tue 09-03-21 09:37:29, Balbir Singh wrote: >>>> On 4/3/21 6:40 pm, Zhou Guanghui wrote: >>> [...] >>>>> -#ifdef CONFIG_TRANSPARENT_HUGEPAGE >>>>> /* >>>>> - * Because page_memcg(head) is not set on compound tails, set it now. >>>>> + * Because page_memcg(head) is not set on tails, set it now. >>>>> */ >>>>> -void mem_cgroup_split_huge_fixup(struct page *head) >>>>> +void split_page_memcg(struct page *head, unsigned int nr) >>>>> { >>>> >>>> Do we need input validation on nr? Can nr be aribtrary or can we enforce >>>> >>>> VM_BUG_ON(!is_power_of_2(nr)); >>> >>> In practice this will be power of 2 but why should we bother to sanitze >>> that? >>> >> >> Just when DEBUG_VM is enabled to ensure the contract is valid, given that >> nr is now variable, we could end up with subtle bugs unless we can audit >> all callers. Even the power of 2 check does not catch the fact that nr >> is indeed what we expect, but it still checks a large range of invalid >> inputs. > > I think you imagine this is something it's not. > > "all callers" are __split_huge_page() and split_page() (maybe Matthew > will have a third caller, maybe not). It is not something drivers will > be calling directly themselves, and it won't ever get EXPORTed to them. > Don't feel strongly about it if that is the case. Thanks, Balbir Singh