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=-5.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 CE879C433DF for ; Mon, 12 Oct 2020 17:11:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5A98F20878 for ; Mon, 12 Oct 2020 17:11:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="pdinanZ3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A98F20878 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A8D6B6B005C; Mon, 12 Oct 2020 13:11:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A42B76B005D; Mon, 12 Oct 2020 13:11:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92C6F6B0062; Mon, 12 Oct 2020 13:11:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 65DBD6B005C for ; Mon, 12 Oct 2020 13:11:14 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 055FC3489 for ; Mon, 12 Oct 2020 17:11:13 +0000 (UTC) X-FDA: 77363914068.16.pie71_4400c52271fc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 05305101603B2 for ; Mon, 12 Oct 2020 17:11:12 +0000 (UTC) X-HE-Tag: pie71_4400c52271fc X-Filterd-Recvd-Size: 4681 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Mon, 12 Oct 2020 17:11:12 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Mon, 12 Oct 2020 10:10:58 -0700 Received: from rcampbell-dev.nvidia.com (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 12 Oct 2020 17:11:07 +0000 Subject: Re: [PATCH] mm/memcg: fix device private memcg accounting To: Johannes Weiner CC: Andrew Morton , , , , Michal Hocko , Vladimir Davydov , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Balbir Singh , Ira Weiny , References: <20201009215952.2726-1-rcampbell@nvidia.com> <20201009155055.f87de51ea04d4ea879e3981a@linux-foundation.org> <20201012132859.GD163830@cmpxchg.org> X-Nvconfidentiality: public From: Ralph Campbell Message-ID: <1d029649-7f34-4f8a-3721-0154001a63ac@nvidia.com> Date: Mon, 12 Oct 2020 10:11:07 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20201012132859.GD163830@cmpxchg.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1602522658; bh=LQh2H3qyxp3qJsZdje88nocGHD8ApGuulqjnVFd+f0M=; h=Subject:To:CC:References:X-Nvconfidentiality:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=pdinanZ3WSo3hvEXLhjY3+I1OdTsCFPXR/so9doT6WLjiCZ900YJfHXigHEIdA3BH eBzuzXwGbMAokDvcMdlvwMnhRroK2u5iwqpAUW+KOqw2R0qlVU2G+N55GKkRVND0G9 SgeNKeXDWCW5+c9QeRvkROP5MkM34rlOQYEt+jX2t1DB/szIN7yHVFG70hdcoGYKx3 NDnfqJkRWnUwjiwSsnOvbIWFZc27fqhxcchQu/rXTiQogEXz5FLzxafOCNXkLEhg1z N/yWpTI9PXZap0CwvA47nsaFJcjR5+MwnQDPF+cOLLJiUilH5cyTg7k62n/7Qup+Td uDC/A81hnSbxA== 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 10/12/20 6:28 AM, Johannes Weiner wrote: > On Fri, Oct 09, 2020 at 05:00:37PM -0700, Ralph Campbell wrote: >> >> On 10/9/20 3:50 PM, Andrew Morton wrote: >>> On Fri, 9 Oct 2020 14:59:52 -0700 Ralph Campbell wrote: >>> >>>> The code in mc_handle_swap_pte() checks for non_swap_entry() and returns >>>> NULL before checking is_device_private_entry() so device private pages >>>> are never handled. >>>> Fix this by checking for non_swap_entry() after handling device private >>>> swap PTEs. > > The fix looks good to me. > > Acked-by: Johannes Weiner > >>> But this makes me suspect the answer is "there aren't any that we know >>> of". Are you sure a cc:stable is warranted? >>> >> >> I assume the memory cgroup accounting would be off somehow when moving >> a process to another memory cgroup. >> Currently, the device private page is charged like a normal anonymous page >> when allocated and is uncharged when the page is freed so I think that path is OK. >> Maybe someone who knows more about memory cgroup accounting can comment? > > As for whether to CC stable, I'm leaning toward no: > > - When moving tasks, we'd leave their device pages behind in the old > cgroup. This isn't great, but it doesn't cause counter imbalances or > corruption or anything - we also skip locked pages, we used to skip > pages mapped by more than one pte, the user can select whether to > move pages along tasks at all, and if so, whether only anon or file. > > - Charge moving itself is a bit of a questionable feature, and users > have been moving away from it. Leaving tasks in a cgroup and > changing the configuration is a heck of a lot cheaper than moving > potentially gigabytes of pages to another configuration domain. > > - According to the Fixes tag, this isn't a regression, either. Since > their inception, we have never migrated device pages. Thanks for the Acked-by and the comments. I assume Andrew will update the tags when queuing this up unless he wants me to resend.