Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3097310pxu; Sat, 10 Oct 2020 19:52:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnwRZHT66z5rN9xu1+pWXpWhy+FQchyLSgRNlOjPyOTWtrkw11jDVNUtj3rxjf+jAFmjhy X-Received: by 2002:a17:907:2677:: with SMTP id ci23mr21189079ejc.270.1602384743036; Sat, 10 Oct 2020 19:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602384743; cv=none; d=google.com; s=arc-20160816; b=XBSbg9XIQ88fpSof8ADSDYijJmtpl4DtIzTMUSuhOVQWEdJV0pE0jD94nI1P3ovRqf BRZ3FSyppbj8olUCYGoFo2MxhQUxb6riJwFAYiAyQCefUh6Jv3COXgM+mryEYGSY4+4T YBleabvfw/AnA2IR+YkFcZfnMNipAZoWyEeq5Y8kaF5nzyqAg92ujmkZyZRnlZkHROjk wbUwaHdY7B6Vuw2Vro2vgYTuYPIrWY2C1UW8yMfG5tAkJn6gqKj3xh1ryvQr3Ciyk+wY 7LagVUGbDsBJwDvs6Us+tXRBO0p10rbSEzNwqlg3XBNhvFMarG/bLYvyhxFm2FhMStS+ 97fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Us6utgoPebZq88AOhUuXmDuRmb+E4XSLkLaXZoYTNTE=; b=TDwsRb+/TeBhk0Dpx5iT4A1F0ydZkn6dwKW1/cvg5/H8Cmtke8/54FELCh+89H8Zzi Wm+1q/abpsaaGcCfqfWoBDuNpQUL1LkjB/pUInmkSBZGU1uIYkugu/mq9s/FKzMQxNxd Nmt+evSEskjnX3odbz6OptuKEnFhCPtus5kUOVGnRXr4gDpoRI7pDpH1VfUKkPFm688e QfdrFuLA/ebgdCxFk89NXMyUGCI6/NxkROim4C37b9UuhySBnoEAebTF6BA5TpjSBmcT eNQF4eZ5UvL/lFd7s7xkfr9M3gauw9QaoK8mpMR+Qo91U1d+W5vaUCakXNhYx5WvvKDh KNHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=iROueIQa; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h34si9553671edd.609.2020.10.10.19.52.00; Sat, 10 Oct 2020 19:52:23 -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=@nvidia.com header.s=n1 header.b=iROueIQa; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728952AbgJJAWh (ORCPT + 99 others); Fri, 9 Oct 2020 20:22:37 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:4417 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728611AbgJJABA (ORCPT ); Fri, 9 Oct 2020 20:01:00 -0400 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== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?