Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1389753pxb; Thu, 4 Mar 2021 10:04:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxlfnuOAE6sUiC/drJzne3X0uwP3DGfZzboSgSGYhQTVI/h32OXdTNPEPVAy7LL5nzh8cL1 X-Received: by 2002:a17:906:e119:: with SMTP id gj25mr5679852ejb.509.1614881058672; Thu, 04 Mar 2021 10:04:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614881058; cv=none; d=google.com; s=arc-20160816; b=ytU5o7ysaifVGWEYm0DPLJSSeHoHVm4BH/ayff9rB1sVhwIcdlQCd5hvvXlBTzCaAn 63ybnFZw86+FnpVd/w/rC29RpHDQX/HVVUnl2efKxWrho8OIAWlyvulfAGlnaOLw79KZ tfC/pAWS3CIWxoXtOCa8zlkA3pBZUuS6rYg44N08SVpeu9I/OLrQg4/BPLK9xkZXI/BW 0pseI4667ZNIN7QmQRAUV4zvAMBpY/lnpOToSh9haH3kL5tBfliy2XnNnFThVRJuzTRZ HMjKsL/EJurlSL0ZI+hb+WHXn/P9FhVmXfvBxI94YBRF8UFpkYHeH1pnrxvGfJBYBRdO fsyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UVTHD8LhK8UyWLEkqfiBsImG1nDjl1nSzP50Iq84vq4=; b=Nu1Kf7VnIklNB35V1q6WdOSMkFq/SpiKxxHa2NCRggAbS6EXJFVKiudsX3nSsf8TbH u5MYdZJC5hJGHsKDF2DAH/mNtoCpfndIgVHcfqW0yFVbGuLUtf2LkSGK0xUmbux1cOCe Npt+HTDTaB1VW9TUgJvyuDBAYP5Oq9OGmKsOOQrLegbEPOPrysBSng9PDdQ/u4uJL06+ PrZ4+YKl5LZN2v+7YeualZk5/kR3mDd11+GAAPM5s9de7se0l7OMjPutO46xkyiTIaAo boyoIAvq8YCEJYBo7JAKhrML/eOSBjtJllMXJ9ehmdHzDf9cFagOF5CPPTV5X1r4Dydx 7jEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=xDlUk5LD; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt5si11063883ejb.181.2021.03.04.10.03.54; Thu, 04 Mar 2021 10:04:18 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=xDlUk5LD; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235845AbhCDPwx (ORCPT + 99 others); Thu, 4 Mar 2021 10:52:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235819AbhCDPwv (ORCPT ); Thu, 4 Mar 2021 10:52:51 -0500 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48490C061574 for ; Thu, 4 Mar 2021 07:52:11 -0800 (PST) Received: by mail-qk1-x72a.google.com with SMTP id l4so13430286qkl.0 for ; Thu, 04 Mar 2021 07:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UVTHD8LhK8UyWLEkqfiBsImG1nDjl1nSzP50Iq84vq4=; b=xDlUk5LDqYnvOZfLk2uhMtwxHSfTd9qm5AkR8hSwcV9x6vspQSOwRQMB44GtB7/tnO B4qdvHAQBjz6juy5G0vWMSZDh/5MOVerzItjEK4W82luWG2fNalBzWQSmZ0kb9iitQU8 E6USb76BAxlvbo9toTBXC9uLyWA0nrtsE/InKO7HpLGDSps0egOwZTT49cxOd9sU93aW rioa9S6y/vmTac1pRuIfCfpqsmBX2nv2TFybF2g2Bf/aZp6f4kPSfuFqEm9wCVJXUBpz NwjX9qIzTFsjpc7BXrA0TW/YLzTgKzCx5D+T4FPiPep3hqkbDhzQc4KiDIN8P36dt+8I GWkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UVTHD8LhK8UyWLEkqfiBsImG1nDjl1nSzP50Iq84vq4=; b=Uo8SwK2XqKigT4lzinLt/6clYXpn0EuC8vLNcxYsX5Pe15XKpSytN1XpIfiIorfRi8 iugWm9umaBpkvH4eJI13ekiUgje+PN8OjKh++FzvwkNrFYy/vN083katNYBw69wV90is 1geSSuG0wuLwpHQoWvadNVshKoTqHXyio2BsY17R45EBGoBv52qb4aR7cPS7C1hcc1np 0Whie9S8upIQ0frSlnE2IKJCExQjrRbp4yFD8oGsV6rLUm739Lj6yBvtqIbmxoLx+93h dDROq1smwHfbtyan/FpJHaGGq8SIFpSG8EoNo+CrJnzYXAEC+moTBXpIxCixVUs784LP FkMw== X-Gm-Message-State: AOAM530WlEpgOfsJimAoMJjjh1aQWkEzPKS2DZlMnAp0abKvclxuZPvD D5kbDWdQ3o0ziUOrNZ7xO9n1uA== X-Received: by 2002:a37:a615:: with SMTP id p21mr4596903qke.352.1614873130597; Thu, 04 Mar 2021 07:52:10 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:b28e]) by smtp.gmail.com with ESMTPSA id a9sm17591946qtx.96.2021.03.04.07.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 07:52:10 -0800 (PST) Date: Thu, 4 Mar 2021 10:52:09 -0500 From: Johannes Weiner To: Zhou Guanghui Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.com, hughd@google.com, 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 Subject: Re: [PATCH v2 2/2] mm/memcg: set memcg when split page Message-ID: References: <20210304074053.65527-1-zhouguanghui1@huawei.com> <20210304074053.65527-3-zhouguanghui1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210304074053.65527-3-zhouguanghui1@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 04, 2021 at 07:40:53AM +0000, 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 Acked-by: Johannes Weiner