From patchwork Mon Nov 23 17:56:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Belits X-Patchwork-Id: 330981 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 337C0C2D0E4 for ; Mon, 23 Nov 2020 17:57:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB28320758 for ; Mon, 23 Nov 2020 17:57:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="UtsY8Dp+"; dkim=pass (1024-bit key) header.d=marvell.onmicrosoft.com header.i=@marvell.onmicrosoft.com header.b="JfB6qWKf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390443AbgKWR44 (ORCPT ); Mon, 23 Nov 2020 12:56:56 -0500 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:35254 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731340AbgKWR44 (ORCPT ); Mon, 23 Nov 2020 12:56:56 -0500 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 0ANHtsnM032585; Mon, 23 Nov 2020 09:56:04 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=pfpt0220; bh=ayKeG63TgdBGMWt1elUzDKUGrj2crvvsQ9p3cwwH5ak=; b=UtsY8Dp+ZO5f3OPsimL93Lnbcl/uYS3ZHxxB+QElzOfKFS3ZIuUZ/L2d2LTe4fDAtg5J vhezygtr+i9EtfGmgeRNCyNmM6ZlfoBsFpKGCNYiqdZOPEb5ByOmYAhjpZM4kKsLbD92 4MduIC9+HFcShFrE2Cugc6juHkvlNJfjdIlbkfXiwVXISjAKz5Il82OY/q5R8+i9G3M9 23uRfc0Rmz2mWkUGVKTlXBZxczl13TQnytwP7uucLfVTM/zuZ67rs3F7ZaNxdbMPgr5a Inx5V8jW/e53TABa7FaImsnagxwwUipFoIpGPEa8XnHHkUsfN6JqpsxUoYtqVmqZhLBm ag== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 34y14u6ttk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 23 Nov 2020 09:56:04 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 23 Nov 2020 09:56:03 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 23 Nov 2020 09:56:03 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.108) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 23 Nov 2020 09:56:03 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i7tm1+76zAtj/vIyFCxE6yQMb4CsarawXzIRT+03KQrO1+nLAuJsQXgCi/xi4tdbcO4aVYrQDCQ1CDwekiXDgVPu/9WhOA5bjlC+TfGjEkDEdtX6QQ084fDspzd3UKMPZotbufJV6pKZeY9lCGEfmyu3aE6lDcdfC1j7KrIQEiF6CKYRf6SHyt/X5oNeIWF3I7fbhBbITxiTkvHFWWJhexpjm79BlQ++mUmShaPI0DnxMncm8jS5egMdI7jTrw3wKlp3OfJs7pHfPmohCyEomXyssa8T2HyiPkCwO9k5oJkoXPLAE2VLX1+JKr/3InShC0jTMT3jVZwFtylbwSshGA== 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=ayKeG63TgdBGMWt1elUzDKUGrj2crvvsQ9p3cwwH5ak=; b=hpxf1M3GjHDdDuLj9bHAXoL2xob1XEKAPPSF/4zEmKSIVPQDbJ6aKVJAxZmiRPf2aZQRgueqvUWae7ttvuz2Ou/UW2skYSnKkHbGhuMac3ihhIphnK3gfkw0L6rHnsrRFkwUQLywqasqajphJiXeiXpGXDQKX0knpWr3JsQT3LAmEXhh2DyuB3d5YkZaCQAPsrXqCBbS39/TyTnvzEqswv8o3rrvF67+fTelBEXkWl9VQNxsw3uDM1swI2lydxLy3rc7QmsjQLwUOOZsbismS0/+/OQUoocKCzf5xlzPsbVIeVLptytUrjrvlVl4yx4q2gTWulBQmWDWAU5SfjZuYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ayKeG63TgdBGMWt1elUzDKUGrj2crvvsQ9p3cwwH5ak=; b=JfB6qWKfMc6J0mdkxZTBVtjb+x2w17wkRHQ447xS0o35X2TgD+OVWylAGNVL3UhTUL7rrrJD7y1RhRSN03Vkr79+BHfLPa3uinWiYAvWGekLVYYZgdkX7iLFzzSchJa+DzfCoarA3285JCMSG0a4PGWhMc6IgwE2inj9CjJeT1s= Received: from MW2PR18MB2267.namprd18.prod.outlook.com (2603:10b6:907:3::11) by CO6PR18MB3954.namprd18.prod.outlook.com (2603:10b6:5:34d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.22; Mon, 23 Nov 2020 17:56:01 +0000 Received: from MW2PR18MB2267.namprd18.prod.outlook.com ([fe80::e17f:37fb:4eb3:c703]) by MW2PR18MB2267.namprd18.prod.outlook.com ([fe80::e17f:37fb:4eb3:c703%4]) with mapi id 15.20.3564.039; Mon, 23 Nov 2020 17:56:01 +0000 From: Alex Belits To: "nitesh@redhat.com" , "frederic@kernel.org" CC: Prasun Kapoor , "linux-api@vger.kernel.org" , "davem@davemloft.net" , "trix@redhat.com" , "mingo@kernel.org" , "catalin.marinas@arm.com" , "rostedt@goodmis.org" , "linux-kernel@vger.kernel.org" , "peterx@redhat.com" , "tglx@linutronix.de" , "linux-arch@vger.kernel.org" , "mtosatti@redhat.com" , "will@kernel.org" , "peterz@infradead.org" , "leon@sidebranch.com" , "linux-arm-kernel@lists.infradead.org" , "pauld@redhat.com" , "netdev@vger.kernel.org" Subject: [PATCH v5 1/9] task_isolation: vmstat: add quiet_vmstat_sync function Thread-Topic: [PATCH v5 1/9] task_isolation: vmstat: add quiet_vmstat_sync function Thread-Index: AQHWwcHncFFYB7yySUCSwy4M4/wQUg== Date: Mon, 23 Nov 2020 17:56:01 +0000 Message-ID: <0e07e5bf6f65dc89d263683c81b4a19bcc6d4b60.camel@marvell.com> References: <8d887e59ca713726f4fcb25a316e1e932b02823e.camel@marvell.com> In-Reply-To: <8d887e59ca713726f4fcb25a316e1e932b02823e.camel@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=marvell.com; x-originating-ip: [173.228.7.197] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a177c911-2bea-4778-33e1-08d88fd90a1e x-ms-traffictypediagnostic: CO6PR18MB3954: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1186; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WeR3fWHdBhlNYuHhjuoI2gi6gCZ1erUXqY612gVYWmlJAUbLJcP5Syi3n76eWrPiKkOJ4T0jsyzT5k9cd5Lbs14RE85Qe/HICzSxs2JSNylUZfp0/NVXm8YnF0Ab7pqgbQbgfgMKxAc+YgTWwrVH6vDUizKHJToEeuLi39dYONBnmhTstAYHeHPu99p2N1R2hGf/XH6gAH4q/kYGeAMJ4Chx57TzHAnZNFo1YVKbGydhGtvHBFduiqEkY8pCqcsu4zyY/WUqxB26HCE3SzFbMyO6AWRz36cnCpSHWxouxTktgDo6pHUn88X13oyK1HbTPTr1MtPGt7ddJQkKcc7Xew== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR18MB2267.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(376002)(366004)(396003)(39860400002)(2906002)(6506007)(6512007)(64756008)(8676002)(66476007)(66446008)(66556008)(7416002)(6486002)(4326008)(8936002)(71200400001)(26005)(36756003)(2616005)(478600001)(54906003)(66946007)(86362001)(5660300002)(316002)(76116006)(91956017)(186003)(110136005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: T01+YFQyVT/f4ttncxpIuAGD2LawA0m61uid3Ji7jj8UhXXgHMhTxTJaDlOE+H06q/w/MsZwILZdj63WbPQ5B5uqKEhN+9wkl2RtUmI5R6uTi3TuTpvyFdKVgrU9SJ4O5XRJdagSilhVg28lF8lZbHCMqYlwz0FrOoDqiITE2JL3dPcDu/Riu6thizwNb0WAsRwR9TKhiiz9KEUAfPemKM86iP+AogeDFWkm1LXf6uOoNKA4GMEFsu+CJn/zI0Tcn60WgHCpXUZFFdF641F2YazWpwB+FRVCFKeTDkPO5O04fNh4icIvyimczk1R9CQWbujmx2wobg3N9kLXJnh04IVNW8NOOgBYsW7aKWQQ622hAEacgLMYtKrh0D5EEYvvYslM2VwYWaT89WSiX6ARnORFpXlJv+ciL8EwX9RviZLJmyr2n/4sUD9DiG58mMItgcHpTy/5/Q64rb676jamlsns6KQ0Fd7AzUUKrWWsdkDRlA0VOyRvCrWt6ZchaWWHUTts/b26MrIMLziD/+prPfdfu/g7nuN48RyEfHZH0BRPntaee4RoqNYOr5GcOluXZ6xVkOdYzlof756NTPhDUFUekMp0qRoRHC6f34YDphN4w2Bs6TjTS1noJaJv/dX/G/Od5HYA+bt2BLfxLtaSrlMorD6DbhvzT2V1ZiPgv9+UgoMD3AVEU0wIoI9QLNwmiughGy8frXjL0wNUOZEInbfOoR9Um5bSDZ++9x/555LjxD45gQOjYGzWBJMNXr4JcAlozDNqBIfzKSNQ088rtL7BvUU7rVBzMQEjPj6SBkS8bWjE4E8inZvSM6IJ4iEh0TVusSkzz6b1xWjkz9weFMo1UUHfiN+8bsztac7ICWs+MJ9e58Ayp8Mahzjatsz0aVk7VWQYhY4YRGl+frrA9A== Content-ID: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW2PR18MB2267.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a177c911-2bea-4778-33e1-08d88fd90a1e X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Nov 2020 17:56:01.1572 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4DTxq/F1OHacfwsrXoBCqTINPgRqURp+6GALpX5cvtQz/qE6fu3iqt+sZjtaUSSKeGQIy+YsqJROt7RkU/ELiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR18MB3954 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-23_17:2020-11-23,2020-11-23 signatures=0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Chris Metcalf In commit f01f17d3705b ("mm, vmstat: make quiet_vmstat lighter") the quiet_vmstat() function became asynchronous, in the sense that the vmstat work was still scheduled to run on the core when the function returned. For task isolation, we need a synchronous version of the function that guarantees that the vmstat worker will not run on the core on return from the function. Add a quiet_vmstat_sync() function with that semantic. Signed-off-by: Chris Metcalf Signed-off-by: Alex Belits --- include/linux/vmstat.h | 2 ++ mm/vmstat.c | 9 +++++++++ 2 files changed, 11 insertions(+) -- 2.20.1 diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 322dcbfcc933..300ce6648923 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -284,6 +284,7 @@ extern void __dec_zone_state(struct zone *, enum zone_stat_item); extern void __dec_node_state(struct pglist_data *, enum node_stat_item); void quiet_vmstat(void); +void quiet_vmstat_sync(void); void cpu_vm_stats_fold(int cpu); void refresh_zone_stat_thresholds(void); @@ -391,6 +392,7 @@ static inline void __dec_node_page_state(struct page *page, static inline void refresh_zone_stat_thresholds(void) { } static inline void cpu_vm_stats_fold(int cpu) { } static inline void quiet_vmstat(void) { } +static inline void quiet_vmstat_sync(void) { } static inline void drain_zonestat(struct zone *zone, struct per_cpu_pageset *pset) { } diff --git a/mm/vmstat.c b/mm/vmstat.c index 698bc0bc18d1..43999caf47a4 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1936,6 +1936,15 @@ void quiet_vmstat(void) refresh_cpu_vm_stats(false); } +/* + * Synchronously quiet vmstat so the work is guaranteed not to run on return. + */ +void quiet_vmstat_sync(void) +{ + cancel_delayed_work_sync(this_cpu_ptr(&vmstat_work)); + refresh_cpu_vm_stats(false); +} + /* * Shepherd worker thread that checks the * differentials of processors that have their worker