Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp924985imj; Fri, 15 Feb 2019 09:04:08 -0800 (PST) X-Google-Smtp-Source: AHgI3IaPlteHuPOCWFEWvq/KW3Jtx9X/ywVFQ5I/rSZmEUjepSRACcxI7X4rVhIJhdTF4nEDGsXH X-Received: by 2002:a17:902:9689:: with SMTP id n9mr11282870plp.8.1550250248172; Fri, 15 Feb 2019 09:04:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550250248; cv=none; d=google.com; s=arc-20160816; b=IbkVQIYP3cyYwEh+C7Zw+HeczXLWblxTr691VgxSSMGmc/A/6ozVi//Iep0JzXvDhK Jf1wocH0GALiJuiKfVWiANmUt35BEV9Gh1uK/pLFiMRP2orsAuh1yjChj62zdKyAhzBv GrlYAmnKV3pMGlGVIh+DbJnaP06NRtaObgv0I5EfbI/+VYt1d/JhO/v7m5JobJ+2p79K prGQlY03aK/37EH0umNGwTdo48sWDuJbYp+QCBX/rzcC/pPz9DVZAi4YddXT5mcimb++ yYO7Epuscfn1GtMB2gvTHjkveEd+ATSE0YmEbOiJFRd0EeW6/VYQlsQIfJ7Ytf0OyD+I P5ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:user-agent:content-language:accept-language:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=oILiAclxTDisBTUNOB4lM3TfY0Ee+VDWLB/xhSdB5Qw=; b=IJLkD3MUXI0Vbidbry+hdH9yCKRReXOe9Yx9x3LRpdIdar1GTQR+UZCCDuaQ8bvQgg MIr5tRqt79k/8gmpXHjhCPaXoN6EIGfKYtdYhNMk5qqEJHOFXLwqrzv2XxLHN0nafUp/ I0thtdcfp3bDH8mGrFQHbpGM/5JJBY0apyNgmeIIy4/OiI8rSd7pZr7e6i2ix1kXqd2S KRmvrIBkcBSCWyXEFNqj7hGryJ8dHx5GAkJvQxdECikHUdxnLk6/jSO+y2hXyXVKuVvO jdBIFU2EQXzG0dcUPi+3y2ShJjkgtK1qRf94s+4BeaDtnR/DsEZz+M8eB1XyETCC9DsQ ietQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=SjJb+ti8; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=JdpF17kN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l16si5859387pfb.68.2019.02.15.09.03.49; Fri, 15 Feb 2019 09:04:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=SjJb+ti8; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=JdpF17kN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728025AbfBOQiM (ORCPT + 99 others); Fri, 15 Feb 2019 11:38:12 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:55008 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726214AbfBOQiM (ORCPT ); Fri, 15 Feb 2019 11:38:12 -0500 Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1FGWt8b005408; Fri, 15 Feb 2019 08:38:09 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=oILiAclxTDisBTUNOB4lM3TfY0Ee+VDWLB/xhSdB5Qw=; b=SjJb+ti8zYy2bWjOfA6Gh8RyDC6hpHkolz7QHm+t+eqpA/RDu+zb1kbc9eksYHg0UBFF r/iExueO54nY5+U9753FkyxMC8kh42BcWUKEGzPfcKjOpT0g2B1ETHubVMcA7Uioo+85 b332gycafljq62QHfp5zxtq7WOyUYqphaRk= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2qp0txg22w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 15 Feb 2019 08:38:09 -0800 Received: from prn-hub02.TheFacebook.com (2620:10d:c081:35::126) by prn-hub01.TheFacebook.com (2620:10d:c081:35::125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1531.3; Fri, 15 Feb 2019 08:38:07 -0800 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.1531.3 via Frontend Transport; Fri, 15 Feb 2019 08:38:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oILiAclxTDisBTUNOB4lM3TfY0Ee+VDWLB/xhSdB5Qw=; b=JdpF17kNHk4UY7QcNGLRNC/6behcDcuUUwcKf/zgr2naseV7AisFdh/1mrZbXL/L7g7Ti29bvaTyihZhNV+QypMD9WgGXor0oUecSae62l9lV5M3P1QLrqxGZSlbuCeFuYOLwBTHz5c1/CkciqEoON7mWQA2nqhdSBFZDWjvo9w= Received: from MWHPR15MB1134.namprd15.prod.outlook.com (10.175.2.12) by MWHPR15MB1693.namprd15.prod.outlook.com (10.175.141.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.19; Fri, 15 Feb 2019 16:38:05 +0000 Received: from MWHPR15MB1134.namprd15.prod.outlook.com ([fe80::93f:b6fe:a6e9:80dc]) by MWHPR15MB1134.namprd15.prod.outlook.com ([fe80::93f:b6fe:a6e9:80dc%8]) with mapi id 15.20.1601.023; Fri, 15 Feb 2019 16:38:05 +0000 From: Dave Watson To: "lsf-pc@lists.linux-foundation.org" CC: "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" , Maged Michael , "linux-kernel@vger.kernel.org" Subject: [LSF/MM TOPIC] Improve performance of fget/fput Thread-Topic: [LSF/MM TOPIC] Improve performance of fget/fput Thread-Index: AQHUxUzTqmvWMcBbakqADGu841l6Tg== Date: Fri, 15 Feb 2019 16:38:05 +0000 Message-ID: <20190215163852.6ls6bchssazma6bm@davejwatson-mba.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: NeoMutt/20180716 x-clientproxiedby: BYAPR08CA0045.namprd08.prod.outlook.com (2603:10b6:a03:117::22) To MWHPR15MB1134.namprd15.prod.outlook.com (2603:10b6:320:22::12) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2620:10d:c090:180::1:5b6b] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 937aeb10-44f2-4279-d6b0-08d69363f492 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:MWHPR15MB1693; x-ms-traffictypediagnostic: MWHPR15MB1693: x-microsoft-exchange-diagnostics: 1;MWHPR15MB1693;20:004eTB3wBN9EasGDlcpi5/JlQcufGjjWApEx0bb1cniwMhQgyAb4zfD+yYF9OygsLR3pZoHlbablub7+K4bz2v0mtGJac9lnpAs771mn15M/6Gr1QEAubTVQwLaKAVz18tjHUrr6A00JJhYYlVGj/hzRJx4b378YOCou7ozciHM= x-microsoft-antispam-prvs: x-forefront-prvs: 09497C15EB x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(376002)(346002)(136003)(396003)(366004)(199004)(189003)(7736002)(386003)(8936002)(99286004)(102836004)(6506007)(52116002)(81166006)(33896004)(14454004)(2906002)(98436002)(2501003)(25786009)(561944003)(81156014)(53936002)(8676002)(105586002)(106356001)(2351001)(5640700003)(6916009)(6486002)(71200400001)(71190400001)(6436002)(4326008)(256004)(97736004)(6116002)(478600001)(305945005)(9686003)(6512007)(476003)(316002)(486006)(1076003)(68736007)(54906003)(86362001)(58126008)(46003)(186003);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1693;H:MWHPR15MB1134.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: fb.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: f7Uo61VHvsEGrirHwGzqpDGuZB+6Ltw5ofoiBeSK8EP8pagxzMOT1OQa5YjO+hG+LyDOY+6ffxEm8fKAdOwysMpzmIxCl42Oew7ZkF/EB5yiyvaaY87VEVWzJWTQgXvSRBlnFx5QgQpan5UiMjjm14a8JPHoU83qNd7HHqsPOCC7pIMd5ErbfDKEcFoJ2Jf+ys+vJoHg62jdhB8Et+NJ9N0p66Hb12wYTLdqbE38wtdDqkAuz9x9bAcb1hH96yDJAb39yl4wGzC3IMGXDpZhHUFaeqrYCZaZ2HQ0vqk8KnkknPJxO1GsgHYOlrPiojRuRZPqe+VrQIbdPxBZ9gy24PvhTD8BbiPxx63TdwIJs4C5J5sHRmayVFHdXTLp6fqNo/0W1k6Mp0bpUMEdkUqwHuP28WyNBrF0yOjYK5D8e/A= Content-Type: text/plain; charset="us-ascii" Content-ID: <3D753BDD5C51904C81AE759469E1EF38@namprd15.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 937aeb10-44f2-4279-d6b0-08d69363f492 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Feb 2019 16:38:02.3744 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1693 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-15_12:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In some of our hottest network services, fget_light + fput overhead can represent 1-2% of the processes' total CPU usage. I'd like to discuss ways to reduce this overhead. One proposal we have been testing is removing the refcount increment and decrement, and using some sort of safe memory reclamation instead. The hottest callers include recvmsg, sendmsg, epoll_wait, etc - mostly networking calls, often used on non-blocking sockets. Often we are only incrementing and decrementing the refcount for a very short period of time, ideally we wouldn't adjust the refcount unless we know we are going to block. We could use RCU, but we would have to be particularly careful that none of these calls ever block, or ensure that we increment the refcount at the blocking locations. As an alternative to RCU, hazard pointers have similar overhead to SRCU, and could work equally well on blocking or nonblocking syscalls without additional changes. (There were also recent related discussions on SCM_RIGHTS refcount cycle issues, which is the other half of a file* gc) There might also be ways to rearrange the file* struct or fd table so that we're not taking so many cache misses for sockfd_lookup_light, since for sockets we don't use most of the file* struct at all.