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.6 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,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 C4C53C433E7 for ; Sat, 10 Oct 2020 00:00:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 310C82222C for ; Sat, 10 Oct 2020 00:00:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="iROueIQa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 310C82222C 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 50BFD6B0068; Fri, 9 Oct 2020 20:00:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BC0A8E0001; Fri, 9 Oct 2020 20:00:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AA5C6B006E; Fri, 9 Oct 2020 20:00:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id 0E52B6B0068 for ; Fri, 9 Oct 2020 20:00:50 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9D054180AD807 for ; Sat, 10 Oct 2020 00:00:49 +0000 (UTC) X-FDA: 77354059818.10.sock88_2b0a869271e4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 60C4016A4AA for ; Sat, 10 Oct 2020 00:00:49 +0000 (UTC) X-HE-Tag: sock88_2b0a869271e4 X-Filterd-Recvd-Size: 3919 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Sat, 10 Oct 2020 00:00:48 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Fri, 09 Oct 2020 16:59:50 -0700 Received: from rcampbell-dev.nvidia.com (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sat, 10 Oct 2020 00:00:42 +0000 Subject: Re: [PATCH] mm/memcg: fix device private memcg accounting To: Andrew Morton CC: , , , Johannes Weiner , "Michal Hocko" , Vladimir Davydov , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Balbir Singh , Ira Weiny , References: <20201009215952.2726-1-rcampbell@nvidia.com> <20201009155055.f87de51ea04d4ea879e3981a@linux-foundation.org> From: Ralph Campbell X-Nvconfidentiality: public Message-ID: Date: Fri, 9 Oct 2020 17:00:37 -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: <20201009155055.f87de51ea04d4ea879e3981a@linux-foundation.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1602287990; bh=Us6utgoPebZq88AOhUuXmDuRmb+E4XSLkLaXZoYTNTE=; h=Subject:To:CC:References:From:X-Nvconfidentiality:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=iROueIQaQrO/x4pGQ5v6OqqoOKyMi9Es4tkR4HMVEI8xMT6oLWIWP6iq1upLtberH +6V4+BWrvHQyJK4yHkyI38Siwr1tQ9/smCkCqt5I2UKBXN4YDAF+qPxgMGkqOll4YM nhbaUlawwEgU59fLkN0y2u6KbDSicb5L5uOgIfvdZiIQBffNQzex1c5VkVSRaz4Rdy 5eXSRS2/vAiMTd2L9aFXo3yM+4RCKevyPDwWuiNCrxl/pHo4+VAav6wyPgMQXMA1o6 wTC2BxUgt6rkx4TpHUfXS15vpEkdJFr1JVNPAHHo8h/r6ZBaT6SjCJWgDGNv2wUq5R 9LLlkYSx66hqQ== 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/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. >> >> Cc: stable@vger.kernel.org > > I was going to ask "what are the end-user visible effects of the bug". > This is important information with a cc:stable. > >> >> I'm not sure exactly how to test this. I ran the HMM self tests but >> that is a minimal sanity check. I think moving the self test from one >> memory cgroup to another while it is running would exercise this patch. >> I'm looking at how the test could move itself to another group after >> migrating some anonymous memory to the test driver. >> > > 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?