Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934041AbdC3PEr (ORCPT ); Thu, 30 Mar 2017 11:04:47 -0400 Received: from mail-by2nam03on0073.outbound.protection.outlook.com ([104.47.42.73]:63296 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932971AbdC3PEp (ORCPT ); Thu, 30 Mar 2017 11:04:45 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=vmware.com; Subject: Re: [PATCH 1/4] mm/vmalloc: allow to call vfree() in atomic context To: Andrey Ryabinin , References: <20170330102719.13119-1-aryabinin@virtuozzo.com> <2cfc601e-3093-143e-b93d-402f330a748a@vmware.com> CC: , , , , , , , , , , , , , From: Thomas Hellstrom Message-ID: <6b390234-71e7-e379-201c-0fb4a05399c2@vmware.com> Date: Thu, 30 Mar 2017 17:04:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: HE1PR0701CA0047.eurprd07.prod.outlook.com (10.168.191.15) To DM2PR05MB766.namprd05.prod.outlook.com (10.141.179.21) X-MS-Office365-Filtering-Correlation-Id: 8d8c5ced-27bb-4b2f-f48d-08d4777e1749 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:DM2PR05MB766; X-Microsoft-Exchange-Diagnostics: 1;DM2PR05MB766;3:OIusH4SlcYd9zmYxsgzAyvSLu54Tuil9n3qEdl+Y9IjcOOH1yLK2VtnDf3+ZVhLpWdrTCpysU8zDfpLlNoa+w6xiITr5iS1QsfgZIgygpUAAQAEqgK3u2IXPXPCaG3KPXd5l7ICBFchiPRfRsG8E1YFLFPZEJWdbd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oGiUxz2qXdPMiTU2eG+jOHtXi5KTn/bkKmRhVm7ehn7sDMsccDkYRjQAiQX5GsiJdChYXmVRIzuRp9ivWIKpRTIlbbMBRfNW4Rd8aPO3zsq9Bx7/4mr3e5V72yl3FzY9gZNWAzhtin4dru4mEyB50U+l9o/ECW3TpQxbwmm06FLwfbnIQmYN629RtToBwlacWitzhjldHO5Tz4iTWIaxdhtuaVlKvI9q7dHRWk+qqkKZkMbMvD0IlT8dD8MkOPjMGrHKVu4Y2zEVvRhJOsFqHxfQMky59LcNZplqBt47ydPhrj3nrhrl2HAM+jF0d9t1nGxkLU/NO6SCB9VClNa3RJXc12Az4MZanevlYdYYaW3/YpPD3tKNnORI3wc5lW+IVwmtT00nP65h1p/hOnTWWvHv+FcGFxlJnhvhrovpD12IkiM79qyc X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(6072148);SRVR:DM2PR05MB766;BCL:0;PCL:0;RULEID:;SRVR:DM2PR05MB766; X-Microsoft-Exchange-Diagnostics: 1;DM2PR05MB766;4:4HLPzVtZZcTVbZcHEGzwcRth2crvjTxpyUmVF4t2UUsNEULypUf4zR9biYDRRrk+Ytg6ZmfvX2o3oEzD4HL/xKEegEJ/7sM2xBahQuvxDS7eM16WJZiGQXfJQIN2QMcQY7WaJUUgzccOvUI9m96Phal9gVB0Pr3p4INM8Wvpev48bgPYPkk2NoAAOn6Sn0o2EeuG0eO28mIm2pKdNIkp0S5hv6tHhyU7SSknUGEOoohheHfKuZWW+laM5HYiw126Z8SGpPCpKKp5TSp8prCqZppy5ExKmuClC512ADVORbTm92cuSk5Nrk66QFnCURYJ+M9Hw62HgqbuTP2ffpAHhBPlbyNSqrZ28CnZFsECVb9U+TbZVpBJLrdt/pYfHDDkI1z9LWb59DDznCW4m5iic45G8z56bxz9h9jbTh5mAU7Utmvx/A7ANkOZn3rUjz0dTKcEulAlnA43TYOz5U6vjqcVGpyNvQN8UZ5jn39AHNF3BDOALpFHbnv7jsZ6EU1DqrNjKFuHeGuIB29c+M1+ESRRNzYXMYTpfCoghde3050yBaGXwnWTb8FedtjleVs6imXEvnZmxw2wR0GbYPtlZvb/Zu+SY3aDC+B4Dzgo7hMGWPAItRZkRitP5pnrGhdNGfx6nl4w7CwtU1ML8L4x2O8FNFLKeAGb/G7D6L3+b+vrTFt8q4vgtRWc0TpJr16rRvhnZCeHhP/qXlI343ewaukoplcQskqkO/WjDLsEYAs= X-Forefront-PRVS: 02622CEF0A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39400400002)(39850400002)(39450400003)(39410400002)(39840400002)(377454003)(24454002)(81166006)(64126003)(2950100002)(47776003)(50466002)(54356999)(66066001)(8676002)(65956001)(33646002)(50986999)(76176999)(7736002)(36756003)(83506001)(25786009)(5660300001)(7416002)(305945005)(65826007)(53546009)(23746002)(4001350100001)(54906002)(53936002)(6506006)(38730400002)(3846002)(189998001)(31696002)(230700001)(6512007)(42186005)(31686004)(6666003)(86362001)(2906002)(6246003)(4326008)(6116002)(6486002)(229853002)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR05MB766;H:linlap1.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DM2PR05MB766;23:Mrc5m+4/ngL5s6MQEETC3ERszs2lkWhWHxm+cn?= =?Windows-1252?Q?Wq3REXcxiT5b2z5WpOyVR55IZ1QmwLotiESLEKy9RjZhoVT1YQJQLPnx?= =?Windows-1252?Q?sthwAqOGayOqzcLZ5qI6az5wQvWYvWvp2luIFEOUpQ4v3O38/dwXalwM?= =?Windows-1252?Q?yCT4rozBSJjAHZUhbeXi/hgu7kQC6Caa7Ya6/QSrTv8u1REkLq4Iz0GU?= =?Windows-1252?Q?ZPx4MfZSEQ2EzcczXilJ/nWNsgpTYLpoM4MZsVjgE+SSZKXD0oQk+Cy4?= =?Windows-1252?Q?cyi5LBgXlQXQhMAwicJvA2eMx0tKIHUElTZRDikEE2ynYpXvFdtrKVY9?= =?Windows-1252?Q?s9O6J+zFYlmppsKz1HSZV9LF/vGnA5RFttvLaO1ll7Griu9mKy3/sbhT?= =?Windows-1252?Q?o8ldSpIeA4vGFcsaN2yUdl5F6OmspFK6zn6saZ7pniLeG3ZjZRyQwpQF?= =?Windows-1252?Q?9f9At63EsrFjKWMEe40wqU17FPrWwK5Cc2oc9RCbAbBTlirRgFLEb4km?= =?Windows-1252?Q?6dk+07YYXOxVkOC4ei67fi+oRCsl1/gykUiHswvnNOkSBJHanXFiad8I?= =?Windows-1252?Q?OCbueSiglDGa/Wtu2q06WA4HeWy0lWrP9UPCtgPU8O4QZdqLndSgLJo/?= =?Windows-1252?Q?JyCIIEMZsLz+Ad0Y2aM6t3vi/ECMBGqQrSyo5pgr6OWjQF/OxyLRy+qk?= =?Windows-1252?Q?s2ZcJwInPsXNwM1M5S4bGGj25Dss0Qz00jyHAMFRr2bD8XkhuOCgaLWO?= =?Windows-1252?Q?CeofAZz8ZYKjqi5Y7nWx/JorPDgk7xS1TbY3F1Dxos4QGx/UZ3vpqvBm?= =?Windows-1252?Q?eNPo7L5t4Lbl+qIHzJCu52tVpOrTq4ODeHKfERQ4oj3zeE/8gyNw7FEP?= =?Windows-1252?Q?cX4NtOufF55eEZwueeONCkXjUbDPw0s7Zv1NSfIhgcJpKVhbTr4Ngz34?= =?Windows-1252?Q?Xqr/DKUe2h+bmsIglxRGp69+nhGBQTOgbqy715MiMx1Fs6HowpvnSP4E?= =?Windows-1252?Q?NGJO2HqZrOPVQP/uBbFWI+K/FKaZmNKiQn9KwVu0ZL3ybBt0tSkfzpor?= =?Windows-1252?Q?PFMTVydzgLliwzZf25jq74qXsOQOkYV5bqr2CbEIWQ/Nr/fyzDV6T3fv?= =?Windows-1252?Q?9OkvhqDI1q4JlonLqUfstx2mQ2OqLpKN2FPuiyRyqAnqhuQUocdS4Qs6?= =?Windows-1252?Q?M1pj3bXhVEFDXOzbSdDb3yE0/j+kI3JwEVunz6wq3IpadiRpL91/TgjY?= =?Windows-1252?Q?tiiVjRh6WvvfPcInHTt5LbB0JYLxFUNPbhtime2EZPiiQ9OAjvYxfxi1?= =?Windows-1252?Q?0wMfBKNGFKjbypJaF5tfRUIygoPRWAqa3Yxu4TtL3z8Ak4ecYRepnxQV?= =?Windows-1252?Q?/WavDg3hky?= X-Microsoft-Exchange-Diagnostics: 1;DM2PR05MB766;6:oD8jUBpSLCBDp66y3dyWcc3bQk6F/xae+tgFIuoqXnDsi92VrtY4L1gf5LkzVyv/rsnENnAVhssJJK1OP+OJJRHO3dM9Pbz4OLl1RTpIzFPu+/44T+s6A9GwhbO//o/qfugiVwSH5NMsje8GE96NgVOkX5Rci9Ui/YwUI5Sfzy0p5aazGtMiZYB9Uz9j98TvKSvX0eL+dyJoP9rh3zKi85xW1JoixwJI/cTc+lUWj5g4cU30iOnPOFw9Kgx+UFbCPKNGd9rjf7FLOtLDMBBxTJu6oeGDx2il80cflmv9ID4J5qE7AlrOkdJs21+GGqfyAnk0OtsKieAjMr9efkHMHH5iD8kJHLgME+YZLnCnjqFu9mveKRqePnWmKK56xfk45WbYo5593rzOkkgyFETj/g==;5:SnTpqzLYeffyflCystgsg+ur8raw3Qx3yAZ6SaMW/6I6I4dIYPAs4PUy959zeN3l6aZH42WWKrdaHKJhfSF/HVmDJOZ2l1dzlZZNm4vvjNo6Yn7S45eo9O1QlR4Wx3784aWSrVtcBRNorvpKEuXcbxffFSlKIEz80j7tNN0hHXI=;24:konYBMF53w/N3nzK+NW05MST1UpFAhC0mJHENh2+R8UJv75VF+/EZJv8oAOfSXczfAdcrdbIywLa04eJMeONb1ddBYJ63YLMyurjlSz9BUs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM2PR05MB766;7:J5B9j41UKLPJWLPJD2Il82uysrze9sOyRZirp89WP5Ue8bl2hZJ6l/zOliexxQ56XS63OYL1RVF5l4dcRPZMSYiXR/z0E8lsUnj6e/cz4kqTLzcZAHDz/xEgjzCQIm/1nQmkyw7OVYZ4HJ/bf0M5s0W2h6/pOsBj8iVSwhr+CGBkAeHeDGyQ04v9okpTQJ3G0ntJCa6L9xV97pSuA3CyfC1lNIztZ145IENlL+A6tZH7wtF3eSfuIniM65I3pE5qrvJAAv1upnHzafEhUWgrfKfwOVfIV1GQzYJYwodNmBJRtFru+nolbkEOKUTPdm7szjFLEHGaxy2IbhRHTSkapw==;20:zdO21mJ+bQEf8VwZ9JypBUibACatAYc9IX0aMWZcuM6X7yC+9KnUrnGNn0u5OxdHKp+919k/EF3zYgxewB1aJI+moVT/pb5ZorFCVMX2XDWsM3c1YDE6Gf69S9ViatIs41K89p6iXCp+Ahf554WHecjgg7JrK+ViklWK4JaR14A= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2017 15:04:37.6335 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR05MB766 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1259 Lines: 46 On 03/30/2017 04:48 PM, Andrey Ryabinin wrote: > 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); > } > For both patches, Reviewed-by: Thomas Hellstrom Thanks, Thomas