Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1438061pxb; Thu, 4 Mar 2021 11:14:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyijmw4OnnXKyadpngGfJWy7A2FJlusZKzj5KHThBS94GCjUshWCIy1b4WDv9lzX3McDPoL X-Received: by 2002:aa7:d954:: with SMTP id l20mr6120237eds.1.1614885282285; Thu, 04 Mar 2021 11:14:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614885282; cv=none; d=google.com; s=arc-20160816; b=uptv+Yq9LJ0xJG2qJkr7VC8/rWH7j8dD7q5I2HWJgAM+JvpX6vwjhSDiiKgvaQmpuC ko7k2steXXDQeoa2EWPAjItOpuWKtFNPQvfZmW+Du6jq/XidSGaLqVyJ6gVxAc5Lh8Je owMa0hXztyTXTlbrOlqTaYbtxypk/OymnqGbNOiQhy4bQ9rKq4nEcRgHJnha5V9Vd7EQ 09rjMkM9zvdlOc2SfU6oykv34dJn9tpQAS/ppnGf3GjEzDQqyAebScgkc8SKL0D5qNHO k4Qm6G//Ct35Va//H5ZqctSzH+ywuVuJ0V0e6vrUz1JrwigZAfkPJsPx4HKHaEzNFM/9 ckLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oIedxvn2pUV8jHqx/T/j7o575rCzZwehOhBHC4/HPSs=; b=jq5GXSAAWzlE2vZdMaowFyVlM74M4zE/e0IYogESX7n4lMNVwWOp7QXcfAIqw2PnOy uB3Xs70Pr8gmS8XNXSYFFSEeRNfBRT0bay34QoJVyzDknT5Lw4yHAJdF0jUUUvJJLYay i/+PEXUKMCDqeC3Eq/ASkB3ASVywBNXEird/aC7dJb8VMFNEV7g83Ql9yq85DCZTHKmt fhcJGZXacXA08+IhEnFya7COrhiy7hR70oM9YBYsN+i0SZCBh2RKdjvZXYFamHEpB7vt MHrPCPI7B/LrMZXokmuIPXV/BtAWCsNtM1NDROyS+ejp9Xo86rjHfh8IV8jr+lJ7ZBqC 6mQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sKgu7jrX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s17si217344edd.576.2021.03.04.11.14.19; Thu, 04 Mar 2021 11:14:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sKgu7jrX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235413AbhCDS4U (ORCPT + 99 others); Thu, 4 Mar 2021 13:56:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235421AbhCDSz5 (ORCPT ); Thu, 4 Mar 2021 13:55:57 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEB6FC061762 for ; Thu, 4 Mar 2021 10:55:16 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id q25so24773117lfc.8 for ; Thu, 04 Mar 2021 10:55:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oIedxvn2pUV8jHqx/T/j7o575rCzZwehOhBHC4/HPSs=; b=sKgu7jrXa097dlgasbFRTSNvGa+cG0zoU1AX9QjQ/L59fLPazlvieepuALAEZ1ivie 75Aw4v2mpGas++khIzwT/ExFDtW6OU4rXhmdgpJj+ncUHWVqKvmXXpOMqSkMG6+gwhFx NJQjIbaOTqzf9MyrcZqPtmG6/t8vmaxJwFTUMn8SbQP/x9IBX/hkbhpHcTM44Mi4AFzD FZ13O1tvKQZnVq6gjvvsJNvnsHzkiGFd+bjL8ckhy5k66gJB6o4sj+CfO5Eth1Y+ThVg 2YNe8hHfRPAyGFAVtU7/o7CuKYJnNLsaCLeRt2RWc7YwuytYgl04NIL3tKnMUovOz088 HFqw== 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=oIedxvn2pUV8jHqx/T/j7o575rCzZwehOhBHC4/HPSs=; b=kS0jByh1JNDkt5MRjRhjOAid5AjUO9FecUO1eUO06rQuXTvytpXJa3viXWxdkhEr5O cK9fNBguiWNqV7gI2HtZyhPPI6hFWYN09WBIDTx+ACz2nuuoluOuU20hJarVfOW5qpB4 6ctFIRVRO2DZfpdjHfF3teyA0/DK89FDRuucJXj+r1PU2XHGUhIMZZ0GzKE83WPIwu9P GOTcjDHEKM6IzIWE8cThtXbr0MPD1Wc8cI9Uvh98ECmsEi6X6y3Hzlb6/ylgAp/WHAid C8Sh5la2tizJIUEyHeIBBYmGy6oRdI9dU86irg37XWvB+I0tSlUrIB89iPUW6TwTozp2 Bqog== X-Gm-Message-State: AOAM531z3/wPWO1lJ4qmQMFlwZWp9l9GADmEl2SJeMrjiG9nsxnDBAVW vXNAJbYhp05JNOUMx04BgcBYhQVi1g+SAIibyAUVSw== X-Received: by 2002:a19:ee19:: with SMTP id g25mr2991727lfb.83.1614884114960; Thu, 04 Mar 2021 10:55:14 -0800 (PST) MIME-Version: 1.0 References: <20210304074053.65527-1-zhouguanghui1@huawei.com> <20210304074053.65527-3-zhouguanghui1@huawei.com> In-Reply-To: <20210304074053.65527-3-zhouguanghui1@huawei.com> From: Shakeel Butt Date: Thu, 4 Mar 2021 10:55:03 -0800 Message-ID: Subject: Re: [PATCH v2 2/2] mm/memcg: set memcg when split page To: Zhou Guanghui Cc: LKML , Linux MM , Andrew Morton , Michal Hocko , Johannes Weiner , Hugh Dickins , "Kirill A. Shutemov" , Nicholas Piggin , ziy@nvidia.com, wangkefeng.wang@huawei.com, guohanjun@huawei.com, dingtianhong@huawei.com, chenweilong@huawei.com, rui.xiang@huawei.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 3, 2021 at 11:57 PM Zhou Guanghui wrote: > > As described in the split_page function comment, for the non-compound > high order page, the sub-pages must be freed individually. If the > memcg of the fisrt page is valid, the tail pages cannot be uncharged > when be freed. > > For example, when alloc_pages_exact is used to allocate 1MB continuous > physical memory, 2MB is charged(kmemcg is enabled and __GFP_ACCOUNT is > set). When make_alloc_exact free the unused 1MB and free_pages_exact > free the applied 1MB, actually, only 4KB(one page) is uncharged. > > Therefore, the memcg of the tail page needs to be set when split page. > > Signed-off-by: Zhou Guanghui Reviewed-by: Shakeel Butt