Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934157AbdC3OrY (ORCPT ); Thu, 30 Mar 2017 10:47:24 -0400 Received: from mail-he1eur01on0104.outbound.protection.outlook.com ([104.47.0.104]:54912 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933959AbdC3OrV (ORCPT ); Thu, 30 Mar 2017 10:47:21 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=virtuozzo.com; Subject: Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context To: Thomas Hellstrom , References: <20170330102719.13119-1-aryabinin@virtuozzo.com> <2cfc601e-3093-143e-b93d-402f330a748a@vmware.com> CC: , , , , , , , , , , , , , From: Andrey Ryabinin Message-ID: Date: Thu, 30 Mar 2017 17:48:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <2cfc601e-3093-143e-b93d-402f330a748a@vmware.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR0501CA0032.eurprd05.prod.outlook.com (10.168.78.146) To AM5PR0801MB2049.eurprd08.prod.outlook.com (10.168.158.139) X-MS-Office365-Filtering-Correlation-Id: 95498de6-b38f-4ae1-57e5-08d4777ba971 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:AM5PR0801MB2049; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2049;3:nlwksm+Phoj/Ms4mWv8uFTdpxAtBc6rj+zAz6eZksPP819GXK5MUnoxY0gbAubEmEFsLHbZtKTlA4FSuBZHu71BYYkDDcBLbUl0rMVOKZurHCoJhOREmoDZlBRpZ5TE/iYTxl4N/B+c7/DYNVeHUKG6r3Fs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aHZFKTGgnK9CXaihUXCQ4H9mexNyHopSRU95bHMdPGg6H5J2xgQTTBD+ZAw9P7SGAcjsjoCEyaV9uUDBhqos1NP2L5lBy2VPKCJz1U8NEnEJVAqYKD1OMfat1vVAFrLUK3k/p7uW/rSMt1gkNkDnpBPG/0tJ7W8gKRijp97WiJjuzZoXxt9m4szXwZbNORsM4YVerCQDbmbzntjGG9pxxnaecC+/xcUUxJqEJDl0W7D/6LDy/XikBaPAp0FU7LlsjVFxzyNz+reZq6kMe5Hf375ugIRTV6u6JkVPCmhlp5IjXOBbpICQu49p5sByw8f1uSDf+p5VgqRSjvyfGv2HeInro= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(20161123564025)(20161123562025)(20161123560025)(6072148);SRVR:AM5PR0801MB2049;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0801MB2049; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2049;4:JWldF09Rc7TclyBEO1TOCP8S5VLZ80UE2D70LirisPu5RBaYhWWg9IJiQZBHKFRYsx7iHDVZCsDbJ2F+kCNB+R0GuOrUpHPJ+q4FRm5Ax5Ur6/afzNDgipZZpbtlVpakEq2EAYyq3B318mgsOLeyfL4y8gZ4+D9F3ZqF4vrY00tX3iFJPm61UWeOSRziWNtqAQ1UILOqkRmYHn7ktJoiIg+/LpGI2N8WBunwrBLSk6sophES72NQDRHcSOqSTCI385Tfluh3ckjQxF8eQ2D/fCnWpFJt9h7+dr5daA97TYsqD6X8d8BRRIkFBC03+4m8wvlXLwuCK2JgJNYxFOt/DGTgdWoI0xu171DMNAtH7Xa+10FmVUtSXkTbpuZ9pN8B9Hxg+3SObkr0IUPZUJR9zcMIL3e6IGujb11Lf8Z1Vbl1D2drEWDkPpRQ5zi+SFBtEVkvLrV7fGEvHASity8tl06M+xKcyP5ZMBI2Q4Mp9l4igrLGemeMeSq9kWvGVe+3cDln91XIh0mw24wE9ms+cfZk8MC3/RzOKyH06zZ9ElEm5MdeJyGldkudVVSH90MNqmfOEy9R9/CG9T5SbV8HrDDtMfG5gDml3mkrJJL3J6TRTyX9G4kvKv1dfdbHlUitrF1pxQuS38boNOWUC+8fI2Z4YpefEjvm0V1wGT24udMvu25HgnUo7a3K4uViyI/w X-Forefront-PRVS: 02622CEF0A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(39410400002)(39450400003)(39830400002)(39400400002)(377454003)(24454002)(25786009)(4001350100001)(53936002)(6246003)(50466002)(53546009)(54906002)(77096006)(6486002)(4326008)(5660300001)(23746002)(83506001)(2950100002)(38730400002)(230700001)(6666003)(229853002)(6116002)(3846002)(65826007)(305945005)(54356999)(33646002)(2906002)(31686004)(50986999)(86362001)(42186005)(7416002)(7736002)(76176999)(189998001)(90366009)(8676002)(36756003)(64126003)(66066001)(65956001)(47776003)(81166006)(31696002);DIR:OUT;SFP:1102;SCL:1;SRVR:AM5PR0801MB2049;H:[172.16.25.12];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;AM5PR0801MB2049;23:AzDQ+PRpWRFO5BCbOUQdskIsd5OagMSRdKi?= =?Windows-1252?Q?3Pyvt2PZ+Q6KerNDANwTSjlTMwKaIGyicvvR0LJVts3+YxQDobSA1RVU?= =?Windows-1252?Q?7muiMbbwoK5GI7PwFT47kAA2Q+1qcHujmVvXdoYo8xvUv6OHNd1BM6ay?= =?Windows-1252?Q?lpymbL0YfVofWvBuX1ZhJ50FBrrogjtAi5IRRaRvv72P8yR3TUdLEUds?= =?Windows-1252?Q?NHQzaJTN8+aaATmfBqGVGIF9dm/h7Z6n+qTmcH413SNn6pEov5wuSmK5?= =?Windows-1252?Q?yee3o267p2DJzO7tzdgiTi8zA5LtJXzlu89DG6XseyRY+XgkLJeOD4ex?= =?Windows-1252?Q?M8yEGmSBLZxHSFjX4GcWomFm2932vMefC2Kye48MuyukTgM2RS1NshV1?= =?Windows-1252?Q?cOWdgtyVUuET6nzQ5U2AUVn/Glzc78smO4WrsPbJdKZSW+UPzTH2Sk6P?= =?Windows-1252?Q?mAZ/mzbAvdManmf5nccv/cASDpvC320bTbG384Xq9wGcZ4Jb8K4hLwHP?= =?Windows-1252?Q?JUcUPTNUGipY/peLWWRW9ZswKWreNVYv95uGXTkTAj3xPY6+A6oNfuU5?= =?Windows-1252?Q?YPT8cUhdOplbGUa1eUCZajKyg327IE6StxNM3GtTLrT8/sL/HFPcAmo7?= =?Windows-1252?Q?Tfg8XfnjAHaUKVpgSg9M38SX6XUbO+EHezPHqkWXe1z8MMlJN/1J2jxX?= =?Windows-1252?Q?06GH/2/uj/6vgD5ZAas2yJxcTN8C75za7nz0fe+Tk5sFulBKE1KcpPnf?= =?Windows-1252?Q?S2/8uB9FIzH6a6EOJQ2HFBxuG9nTcOKGmXr1oaeF3BnHkGIHX8ECcwKs?= =?Windows-1252?Q?geO3fcY3MUUNzIoXo0MLljNsuHedRgYJAzf+UBsIUiJ+SbaO//06ZySg?= =?Windows-1252?Q?42tU4RaIPfHTIAu9soR+/yEH5Fq3neBglIRNBF6Y9DsciqRtzMqIWBIs?= =?Windows-1252?Q?TSiSbiDUOyaeOqh4UCfdxwvaxPpRkvBthXDgUVryiLgPHhewfEV63FsA?= =?Windows-1252?Q?Hw26URnFsv3YfXCDwSQL+597Vlw6IN6fw3Tirnh/it7FCCFU6IVbVpcv?= =?Windows-1252?Q?7Dbr9nvyY9YFKFrf7IrkGrXMMiwYjRvU6+4ilRoluUgiBYYQLlSPYrdN?= =?Windows-1252?Q?QAJ98yYQieCN6ymj3qk9FxTCB5tNyrlitqgMUYfDq80NQLFgbQJWwQbK?= =?Windows-1252?Q?kb+rMjKFmQSYLjHm6sUWjRP2wLkvDp7a+iJo3X4dn8tYHLHMJGO2Flvu?= =?Windows-1252?Q?W7gxZC7w63P71TDMnX0OisU7U5sNGrqIXpcz4lReZD85RRep3fTfXXEq?= =?Windows-1252?Q?oTaKTK+kH/DbAPojG8OgpJNxw4bwzuuk2brWCKkVDjqA2gww=3D?= X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2049;6:RFQhaN8EWaVfRtwa398XAxvpPtwl1A9cvprz+ZkB6jW2YsVpv72/pxS2K0QGDmtwhy3LQuAkx12yh27f166Yu7taIkP64jNJDmasfpZcKtZmOUz3owfkb0BZWj1PMwH54YYYrcYsfQkEC6IiQXoE9OdClebwvoW8VtGXakdc8+A9sgTaOzwrW3+mOO5lWwpAXHUg+JejTwpDezHRBYldpU8TGkAdga3NDSXG38oMgnBPPnJAPiri0aGXkCGwB6kh2Tdsv1nXoYwNeWDTSHr7heBtT4defF1Ld5a6UWw9ziB19ug/mZQwHnyMwsCSfa6LqSCG1GgWy+1OSjhar85p8Q0Pz6SXz9j9LBesOwOqFPFuUbZ5hAUAli4hVRgK9ZlwrzYDihIKImwD1JBKfenZ4w==;5:0Uj9bSYaZbenW+M3M5R3bUVrcvbQeFL4ypu2cFVqbMfyevz20ugKlf3gC3u5eUk3V7WrWMdFE0VDsA0J4EbHKrtXf6pEEb7cSA2lFxxEEs1nTRYJLPa4jWDAdV671NCZaCHw/vu2asgyQb5J26QSYDjvbXhCWD1UVQB3y5MfJ44=;24:wwRzJTtv0RbPPo+Eqkn/yHOhdDQkfcfcCZww+FSAkhTBbwMiaXGlh4iuBR9cPkciECDlAm+sYvh7rd26CikGIae2FPpbRZbG+kM6/nfLxD8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2049;7:N2KRQJt66l6zcrspOw3bg6Z3XP3hdGQHhg+Z4afI5SOe8MZtaJe2US+6CQlZOhKkoRaEjYYxd7Nu3h7tmhyJ60iN5pP5PSZBB4krM3uUQcQZmWclqwEPohkI84U/ziuwjeVHQ2qpRky9aYo2Or9y78gpYP0dpgJH54KtVchZr9lO9vqUM1aBbJEutrHJt3lakhlmyIaWyVjIFnekvLfBOj/fvbgjC5zEo9Yt5veH/HuBtsHucxyasWq1llUEWTqP/lGYF8Nu+iIqBMA3Icey8hDev44QVf2HIkfq50Ek1BbwwCo1ddHloTHXJGhsBJhx16BihUBdNAwrXKgocErVaQ==;20:UsFoQXWW07aLdy86bxKsC0cpk5St63QCrBPqihTvmD1TpKZISngPYuKj+XXMkAFy8xi+9YUK38PAcDs3/coiQf5bwZCaEYi4dK7UtUo8b7H874TYDy1nStOWnPKcjrrA8ZpYLWZmlyWpHljAQgge18pFfXhtWKvLp9nbNJNb/YA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2017 14:47:15.8230 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB2049 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1078 Lines: 41 On 03/30/2017 03:00 PM, Thomas Hellstrom wrote: >> >> if (unlikely(nr_lazy > lazy_max_pages())) >> - try_purge_vmap_area_lazy(); > > Perhaps a slight optimization would be to schedule work iff > !mutex_locked(&vmap_purge_lock) below? > Makes sense, we don't need to spawn workers if we already purging. From: Andrey Ryabinin Subject: mm/vmalloc: allow to call vfree() in atomic context fix Don't spawn worker if we already purging. Signed-off-by: Andrey Ryabinin --- mm/vmalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ea1b4ab..88168b8 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -737,7 +737,8 @@ static void free_vmap_area_noflush(struct vmap_area *va) /* After this point, we may free va at any time */ llist_add(&va->purge_list, &vmap_purge_list); - if (unlikely(nr_lazy > lazy_max_pages())) + if (unlikely(nr_lazy > lazy_max_pages()) && + !mutex_is_locked(&vmap_purge_lock)) schedule_work(&purge_vmap_work); } -- 2.10.2