Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3282721pxb; Tue, 19 Jan 2021 19:56:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6A8MKQafZ1+9qcUzGNEYKPI1Vh4Yt/CUSUS3NGEh5dpVSgbG5K5soR8yscual4i43M7nh X-Received: by 2002:a17:906:a106:: with SMTP id t6mr5013964ejy.63.1611115006596; Tue, 19 Jan 2021 19:56:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611115006; cv=pass; d=google.com; s=arc-20160816; b=CyHtdTtFiOmca70ILeVbblLPi5hFrPKagRhk+Qz/wZ89sKv5HlwYDV97OsmOvYUKZ0 yFObN8AXbzzH5Ecenqr74z5HKL1J+WsX1HUB5uMZZB9fe0h279IXDwLfPS15Y8jtWW+E wsVvgCddpsHAxxUF4yuLlTvyYVrC6hqushlZt1BD8faYAFYUkOH4WYJNvUkXaJS4byUa Vh+7gTZ4vtvM1f7JKH1AwNlOxiQ2f8dm8juP3TvfraIIPCmUHJW4tKuLpM+1KZU5PA2j 1sqxTCEOzjDzgwXULch+NTLJhXYlNvZZhPmEhnm9p7nrmfdqBS8tU6c0V0oS9GKQ7aCh ORMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=xZJt1aepH3pNR4HHKasL7XVT++h+k3Umn91Ql/jk6Pw=; b=bV7m3oGTcEy+rYJoH1XGjcOdrXqOsIHrwCf7Ya21NJs+mSDzHQjHjy5voCCs1sqB2t Ll3JV6reRd/0R4v1FBi1eDyVChMbawxDMllgtvGKgx6i+E9iebEwBzkdm0djEM19/2wW Zjp36fxwMnSHl9WXuIcpxUiYCHT3JL4XxJYlShBHQHZvDq6OUFKGg1o1Whq2ukegQ25v Hdb+QeQtgKI/3vsYOa4w0xd+d8j1v2qT20mAfTllI5BTtSIFrszquXZuOtKF+WV8ANTe rQDdL+oa/ORBYFGh1Ox4DTc5NvgeQ9BJ21CQCy68Zl4B8usDgxp1mD1b8ioIrO6jE+Ur HjbA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=dRbxDZ8u; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector2-fb-onmicrosoft-com header.b=JPjphiPg; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si262250ejb.527.2021.01.19.19.56.09; Tue, 19 Jan 2021 19:56:46 -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=@fb.com header.s=facebook header.b=dRbxDZ8u; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector2-fb-onmicrosoft-com header.b=JPjphiPg; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730450AbhATDyA (ORCPT + 99 others); Tue, 19 Jan 2021 22:54:00 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:63664 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730032AbhATDup (ORCPT ); Tue, 19 Jan 2021 22:50:45 -0500 Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 10K3moQl009623; Tue, 19 Jan 2021 19:49:56 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=facebook; bh=xZJt1aepH3pNR4HHKasL7XVT++h+k3Umn91Ql/jk6Pw=; b=dRbxDZ8u3QIB4zk0PAxFru+XB+hu98cM/+nJ+UCXnyyjMvmNAKsuECvlSQujCzFjDmsy F00/piMvqtDG5QvRmCCQy4gQ/pCqj1vieaoRssKusSioIsfL9ssavUvl72pTxSpm7zfu un8AQblBQ4+L62/iGk4QqdxKyczxTxpsoRM= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 3668ph956u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 19 Jan 2021 19:49:56 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (100.104.31.183) by o365-in.thefacebook.com (100.104.35.173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Tue, 19 Jan 2021 19:49:55 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pt2GJtTENxhfocMjKxgGeK1OTtByJQgNm91RP53Cp9S6Fq3shI/0GbgVMNqB5LkqCkxB0QN1vuuGiYz8PtN+7LHxgT7G5QPkPIe7jHttJhlBD4QMXTGZqZKo0BsoJIaZBxIRvd+tloLgiRTnVuryqVRJytGt3AW94qwjH1TpnZSWNazABdpjo2Rom1MWoaUyrxLIbQ4crZR8fuemG+iMBUe6pqSysSPOpoo7ljZIGnKfv5vmT7enGPEHZcbJbkgLGbW7qa4Aba+V7aVKGNDp3ASkB/WIUX02B89cdzQFVipfzvW+hNyrGr1Q/NN1woirnnvwTYBd/hiasyPfA0mdkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xZJt1aepH3pNR4HHKasL7XVT++h+k3Umn91Ql/jk6Pw=; b=IoshRRuVA/jTNVhW4pjgnKFfv+0Zwed7O6vou2J3Mif5wkDUiBuSl3s4nnl2LMPY0LvxJPQx81L+i1Cxa8vKikRKl4K3FWo25PxsVGtIJ4ixw8PxLkBc/R0j2iGa0WCk3zP8Wu2rWKP9+ib2aakLfuWQPt/3wS/sLHRfRoMXYxFHIiirmi/BMlint2J6o00P83QMZf48Db6Z+YVUtM6QdNBJ0EahNCn5+xQHryXPjQ5DlUFG/+fqP6JwXqYQma4gf/2S06VMyHDEuW5mGlhyncnhtrgGhCAf1A5hEzpwiaPuMy1uH9dSR2zo2+F/aNPgBSdbZ6EuHxcLMAVXC22d/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fb.com; dmarc=pass action=none header.from=fb.com; dkim=pass header.d=fb.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector2-fb-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xZJt1aepH3pNR4HHKasL7XVT++h+k3Umn91Ql/jk6Pw=; b=JPjphiPgD8yclzXEkFLw3maMh6cop9gKVc3Pmnk/V15x2EqZyKfw7wm4q8cnpUcHjDk2YK5x/SmhU7yv+E2UXC0cpySgFcOEm01X6iZctwan32oyLv0WTLQn97wMpDgr/T0C/cuEIcdTuHsaA+J0Q/2TMyizFisrj4NBg0X2+vc= Received: from BYAPR15MB4136.namprd15.prod.outlook.com (2603:10b6:a03:96::24) by BYAPR15MB2214.namprd15.prod.outlook.com (2603:10b6:a02:8d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.11; Wed, 20 Jan 2021 03:49:54 +0000 Received: from BYAPR15MB4136.namprd15.prod.outlook.com ([fe80::53a:b2c3:8b03:12d1]) by BYAPR15MB4136.namprd15.prod.outlook.com ([fe80::53a:b2c3:8b03:12d1%6]) with mapi id 15.20.3763.014; Wed, 20 Jan 2021 03:49:54 +0000 Date: Tue, 19 Jan 2021 19:49:49 -0800 From: Roman Gushchin To: Arjun Roy CC: Shakeel Butt , Yang Shi , Johannes Weiner , Michal Hocko , Eric Dumazet , Andrew Morton , "David S . Miller" , Jakub Kicinski , Linux MM , Cgroups , netdev , Linux Kernel Mailing List Subject: Re: [PATCH] mm: net: memcg accounting for TCP rx zerocopy Message-ID: <20210120034949.GA1218369@carbon.dhcp.thefacebook.com> References: <20210112233108.GD99586@carbon.dhcp.thefacebook.com> <20210112234822.GA134064@carbon.dhcp.thefacebook.com> <20210113184302.GA355124@carbon.dhcp.thefacebook.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Originating-IP: [2620:10d:c090:400::5:bba5] X-ClientProxiedBy: CO1PR15CA0109.namprd15.prod.outlook.com (2603:10b6:101:21::29) To BYAPR15MB4136.namprd15.prod.outlook.com (2603:10b6:a03:96::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from carbon.dhcp.thefacebook.com (2620:10d:c090:400::5:bba5) by CO1PR15CA0109.namprd15.prod.outlook.com (2603:10b6:101:21::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9 via Frontend Transport; Wed, 20 Jan 2021 03:49:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2fdf1bb4-ddcb-41ce-a089-08d8bcf67241 X-MS-TrafficTypeDiagnostic: BYAPR15MB2214: X-Microsoft-Antispam-PRVS: X-FB-Source: Internal X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jul1gIzMbzFGuGgtumwAlSRN5qDbhps/7kPTE171f9WpV55PxWQwrSsqkEZVaAin3hvu8XsAU9+bXoJS9EWEVAPTfuPJ8oJwQcVgFzyYZbL+CudHF/oYC6pLDieLCNUJj4Ry8LH+Tf0uNJKMuItvOeydPSduus9DN19yVws15gsRvU/MP3E7KMaOL7bME1lxFiWKrXvprpc/NslmPpxDnRZQsOYMxLJp0myEzuyy7cbadShl8pGMGoggo9W3o8+d8FjXDg7Nh83Zmu4nT2W6cy8gP7UGsfznpn/Xy5zlXFGnrPn+GFMTOzN5vZIBTe0g5hSnJVRRnP85a0s77M0A0CA67cBt4Amc+vjQe4fjuof9cZRgZpoOO6zHTVpNGkDy7VNynAj4AidAGaQ7dx+lXdk4Qkx7sBJTH8/Ldav2IQGIJJJ2rZ8wOV4dIhften7Iuyv5egdmLgb3t+DATqTFBERCg2Qw1ywhdKb+1y8Var1coQ+iZnkk5EzrwzrD+KhJuHEFMgyw+ouBRbg4UpDDFA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR15MB4136.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(376002)(136003)(366004)(346002)(66556008)(8936002)(86362001)(66946007)(83380400001)(478600001)(66476007)(1076003)(55016002)(15650500001)(6506007)(16526019)(8676002)(2906002)(53546011)(316002)(7696005)(186003)(54906003)(33656002)(52116002)(7416002)(6666004)(5660300002)(9686003)(6916009)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?sqtyd8sA90kZjBFuIYkBRVWGIWlXhXJw+UGd6xAM+xQSgcWRZ3+WiXhzXP4j?= =?us-ascii?Q?EHGTI7sOxM/MbmjV2tg+soGGXQ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lapLN5VsS18jDRZOxDDh4HUdEu8wU4nYv9Zhtnh8g5LoOOlvnSeiisJ9nMDA?= =?us-ascii?Q?oVoFvLzQPFccTBS90rb0XdmTIA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 2fdf1bb4-ddcb-41ce-a089-08d8bcf67241 X-MS-Exchange-CrossTenant-AuthSource: BYAPR15MB4136.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2021 03:49:54.1183 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W9xPVm2kG9JsKaI4CQ6z/NUyDssevgno4Kmdx3fdgcu0gavAuV+dszRBmRWWsaWi X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR15MB2214 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2021-01-19_15:2021-01-18,2021-01-19 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 priorityscore=1501 phishscore=0 malwarescore=0 suspectscore=0 impostorscore=0 adultscore=0 clxscore=1015 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101200020 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 19, 2021 at 07:31:51PM -0800, Arjun Roy wrote: > On Wed, Jan 13, 2021 at 11:55 AM Shakeel Butt wrote: > > > > On Wed, Jan 13, 2021 at 11:49 AM Yang Shi wrote: > > > > > > On Wed, Jan 13, 2021 at 11:13 AM Shakeel Butt wrote: > > > > > > > > On Wed, Jan 13, 2021 at 10:43 AM Roman Gushchin wrote: > > > > > > > > > > On Tue, Jan 12, 2021 at 04:18:44PM -0800, Shakeel Butt wrote: > > > > > > On Tue, Jan 12, 2021 at 4:12 PM Arjun Roy wrote: > > > > > > > > > > > > > > On Tue, Jan 12, 2021 at 3:48 PM Roman Gushchin wrote: > > > > > > > > > > > > > > [snip] > > > > > > > > Historically we have a corresponding vmstat counter to each charged page. > > > > > > > > It helps with finding accounting/stastistics issues: we can check that > > > > > > > > memory.current ~= anon + file + sock + slab + percpu + stack. > > > > > > > > It would be nice to preserve such ability. > > > > > > > > > > > > > > > > > > > > > > Perhaps one option would be to have it count as a file page, or have a > > > > > > > new category. > > > > > > > > > > > > > > > > > > > Oh these are actually already accounted for in NR_FILE_MAPPED. > > > > > > > > > > Well, it's confusing. Can't we fix this by looking at the new page memcg flag? > > > > > > > > Yes we can. I am inclined more towards just using NR_FILE_PAGES (as > > > > Arjun suggested) instead of adding a new metric. > > > > > > IMHO I tend to agree with Roman, it sounds confusing. I'm not sure how > > > people relies on the counter to have ballpark estimation about the > > > amount of reclaimable memory for specific memcg, but they are > > > unreclaimable. And, I don't think they are accounted to > > > NR_ACTIVE_FILE/NR_INACTIVE_FILE, right? So, the disparity between > > > NR_FILE_PAGES and NR_{IN}ACTIVE_FILE may be confusing either. > > > > > > > Please note that due to shmem/tmpfs there is already disparity between > > NR_FILE_PAGES and NR_{IN}ACTIVE_FILE. > > > > BTW I don't have a strong opinion against adding a new metric. If > > there is consensus we can add one. > > Just wanted to see if there were any thoughts/consensus on what the > best way to proceed is - should there be a v2 patch with specific > changes? Or is NR_FILE_PAGES alright? I struggle to see why these pages should be considered file pages. (NR_FILE_MAPPED is a different story). I'm ok with slab/kmem, sock and a new metric, we can discuss what's the best option out of three. > And similar query, for pre-charging vs. post charging. IMO double accounting is bad. If it means post charging, I vote for post charging. Thanks!