Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3426667pxf; Mon, 29 Mar 2021 01:46:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqqaAkuqQkxKsNNDrr6/jJKsrXJ9ulKhKvfUxVzo+6h2yMzFF/9P3UZ6Axl7CaheEZ2YyN X-Received: by 2002:a05:6402:1283:: with SMTP id w3mr27258069edv.340.1617007568765; Mon, 29 Mar 2021 01:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617007568; cv=none; d=google.com; s=arc-20160816; b=g01qJb0s1Wuede6oJ8Tylf27NFEsUPiFydGeZuS+PAEa4/Bo0sVT1/ek4z5a5XfjDX aZb5cnkQR2KVKyG/IIuBrP2INRW9CI6faBj6Kj8lSzyt3SE6L137AYsnCsbcNu5ULb0E H03gZi7/7dxrO6dX0DY0f4b4iLQYWWoiPh3ZdumD2TP8zMfbzlDvpoXmga/rpZ0HJLk0 ehm17vobtnI1yodH6cjpW6PiDRCkSH53naGvKLE1UT5xRWskDkPIEu//QoiLQFzpk++z MIRPcHe1lmKjhyxaTu/dNcW2o3/WrdDQdK7as5SLaewHuMd65QsVKEh8F3s9D2sFA9eV XCOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AgtlbA6QInVy8kZTK5QC7lEXGhXm8nvjdx5yzh51xfM=; b=AtgOOGTnPA6pwIl+1ISVd1BlwZFLeglBfRDMlUk+Hu/Y2GAyX8BEQqZuOTiK7HV/uM 7X+uOAi3B9N4tGUDi8B3vRRyzVijx+ff4auL517TFLiS6ZxTmqz01kMaglsDgTDAv+S3 eNHInwU+lLx1dJZU7pm0xscAFRvwwgCDEwZSLAyWh4nTgVj1GVXe6/0xBAMWt/yrLcoV zX79J+eL1ZwG2mnbnWr/qX7snLuErMMv0Kkp1jXlD5Q8cQD8TY3rw5fVxGZj0GYmJeZ5 hx7/nEZS6icFMek7ubhgrYSPEGRBcHJbNg+XnUKb7wWKKT9whegUB2PbXzREl1CXWpnr 5dCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H3I9X7LK; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t19si12589108ejd.179.2021.03.29.01.45.46; Mon, 29 Mar 2021 01:46:08 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=H3I9X7LK; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234799AbhC2IoU (ORCPT + 99 others); Mon, 29 Mar 2021 04:44:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:41832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233749AbhC2I0z (ORCPT ); Mon, 29 Mar 2021 04:26:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EA252619CA; Mon, 29 Mar 2021 08:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006353; bh=+bsrpx4cNVUktMcDSEJnM3RMt0AKF3D62/wDJ/q8e/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3I9X7LKS1hjqqgzqKOHoqX0FmfCWaJa4gDX2naZ54vv6bSeWATZnGTPULxphQBa3 DCUtAsfV3/nkK9jcB7S1hkFk0dfDdpflGSyHRNeWPe2iMtArLSHNVVukRLid3KkApw Z5RYw2g9JrRwVlesjt8iubNetsmWDnrpJbV1JJ/M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hugh Dickins Subject: [PATCH 5.10 209/221] mm/memcg: fix 5.10 backport of splitting page memcg Date: Mon, 29 Mar 2021 09:59:00 +0200 Message-Id: <20210329075636.083883684@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins The straight backport of 5.12's e1baddf8475b ("mm/memcg: set memcg when splitting page") works fine in 5.11, but turned out to be wrong for 5.10: because that relies on a separate flag, which must also be set for the memcg to be recognized and uncharged and cleared when freeing. Fix that. Signed-off-by: Hugh Dickins Signed-off-by: Greg Kroah-Hartman --- mm/memcontrol.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3274,13 +3274,17 @@ void obj_cgroup_uncharge(struct obj_cgro void split_page_memcg(struct page *head, unsigned int nr) { struct mem_cgroup *memcg = head->mem_cgroup; + int kmemcg = PageKmemcg(head); int i; if (mem_cgroup_disabled() || !memcg) return; - for (i = 1; i < nr; i++) + for (i = 1; i < nr; i++) { head[i].mem_cgroup = memcg; + if (kmemcg) + __SetPageKmemcg(head + i); + } css_get_many(&memcg->css, nr - 1); }