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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham 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 B48CDC433DB for ; Thu, 4 Mar 2021 18:55:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F1DD64F62 for ; Thu, 4 Mar 2021 18:55:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F1DD64F62 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7381A6B0006; Thu, 4 Mar 2021 13:55:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 70FE56B0007; Thu, 4 Mar 2021 13:55:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D8C46B0008; Thu, 4 Mar 2021 13:55:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0030.hostedemail.com [216.40.44.30]) by kanga.kvack.org (Postfix) with ESMTP id 424716B0006 for ; Thu, 4 Mar 2021 13:55:24 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 04410181B1033 for ; Thu, 4 Mar 2021 18:55:24 +0000 (UTC) X-FDA: 77883094968.14.89BBF80 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf20.hostedemail.com (Postfix) with ESMTP id 2AD842393 for ; Thu, 4 Mar 2021 18:55:20 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id e7so45033865lft.2 for ; Thu, 04 Mar 2021 10:55:21 -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=YEwU/Jj8riTGH+eRGowvd+I5Bswt2Q+duJqrxvt2NZMwDlIbpXeE41e8JnCDh+7n43 yiA/2jbxcuI2lRGvs5+6JWEVdVmrVFI/BUXFXIX8iz3842FuQsgzXwe4OMviR6IqXWyg nJ9LcQmV3+6vBX3ZFz9xkfABdfHDUB1ThCIWLHiWldHZAvR1iiwi4xaEEj6KXyDoeJsS u4haeJ/YbUnolqSZJjGSmgh1htY+zYAbzuDXgH95TIZipjGmpcnvWSsC4idZQxgoUL/C nZau+ja+MIBYug3/bdOVH958I4NvpMz/igM+pPuniKU3dxTV8ID78ykWW+vihFabZhea 4ijA== X-Gm-Message-State: AOAM533jJZjYYWwk8UxZM1XttE/YTszLKsB0DwIHbw8BoPqb7M/08lbX SDYU4gcDF8xOU0GBeaG7D1AgvF7vQYYs7ivEVgNVzw== X-Google-Smtp-Source: ABdhPJwSUSBW0MkbaQYXDHv3jvqkvvYIRhVI5aH1FjZSipRDqhL8UKv4oFt+GYqnm4WkNCVLdKPlOOsilGpeRJb4inQ= 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" X-Stat-Signature: w8p8n8n8nm5ks4j8p89gfodqbzfuy3ga X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 2AD842393 Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf20; identity=mailfrom; envelope-from=""; helo=mail-lf1-f49.google.com; client-ip=209.85.167.49 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614884120-832010 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 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