Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754101AbcKHRgt (ORCPT ); Tue, 8 Nov 2016 12:36:49 -0500 Received: from mail-ve1eur01on0122.outbound.protection.outlook.com ([104.47.1.122]:44256 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751749AbcKHRgo (ORCPT ); Tue, 8 Nov 2016 12:36:44 -0500 X-Greylist: delayed 90591 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Nov 2016 12:36:44 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Subject: Re: [PATCH 4/7] mm: defer vmalloc from atomic context To: Christoph Hellwig References: <1477149440-12478-1-git-send-email-hch@lst.de> <1477149440-12478-5-git-send-email-hch@lst.de> <25c117ae-6d06-9846-6a88-ae6221ad6bfe@virtuozzo.com> <20161107150947.GA11279@lst.de> CC: Joel Fernandes , Andrew Morton , Jisheng Zhang , "Chris Wilson" , John Dias , "open list:MEMORY MANAGEMENT" , , LKML , "Andy Lutomirski" From: Andrey Ryabinin Message-ID: <747aa42a-c236-ee25-eef5-59644687f01b@virtuozzo.com> Date: Tue, 8 Nov 2016 18:03:58 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161107150947.GA11279@lst.de> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: AM5PR0501CA0027.eurprd05.prod.outlook.com (10.164.187.37) To VI1PR0801MB2061.eurprd08.prod.outlook.com (10.173.74.146) X-MS-Office365-Filtering-Correlation-Id: 52388fa2-c74c-4ca6-6d08-08d407e86c67 X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2061;2:MuqEvifDU57mAHccXkljIQUXuNDjOyYYwyl1/MkC0TdPoi8nl29l07GNpgiImY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IhTBvJ3Zb01k5S+wbm+78fW/38JeXky8ASJwd9CeJQ==;20:rhHUID/F/ef56H5VgOrTZJIwJzeicNxoHu6kUNNH1o5KTDO6Sf4XB4HI0MWLJX/3f6DQ283DEunA/fU4wcYlP/ZE+UaV8vML9IOifgaBj3qzm/Rx2Pp/QHkIHBMG7aHkPUWUBbqa/LAcJnZj6zEcoM+vLbv9aKeZms91EpB4ZFcF6qhNhB+JRyKgwOiW0Aa5u5lIzFF0Xg22v1cj9Gmj4UC0ZVlEu201ZGYn9wdmxsGLneZ/hBWzjVDBc7aBnp7H X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6042046)(6043046);SRVR:VI1PR0801MB2061;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2061; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2061;4:iGRrlUvG4F9DMia1272rBO89+LZ0mXJV6wt2wC84Tx93+Ds1jV0xig5qUtIjAUpwx0Ox1/4wGPR2LWXitbZO8npj+qJGUnF5c1Ufa5u0jU+dC5YtXtSZyFalhn74QYEhwYd5NGCz6M5i9u3TeetEwaInP1yCZPGImiPwCbnV+c6yWoGNdfELE9AZfJIR2+951j446ZTQvol/dXs5u6msvMC2kSOyGC87bOG6F/6AyY7rzdIrFZVt3g/gxKYXfDQ1eDIW1zvuepwAXuL+mBCYOablO7hFCOCqWQuyz4WCinpI5Fwsh3IsJDpClOoHzC7D1GPJxajBoCfmWI6vx7F4TRXlKrKHT6CPK6TtNxICxQoUh4rLfI4A0hTSjYFtkKgH2d1p5/GRMNCinFsLv9gv5mKTteBSy2fgx025oe9dPtZM+ugWe3sghL31u7VO/1L0 X-Forefront-PRVS: 01208B1E18 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(24454002)(54094003)(189002)(377454003)(199003)(101416001)(65956001)(50986999)(77096005)(54356999)(76176999)(47776003)(31696002)(6916009)(586003)(68736007)(3846002)(6116002)(6666003)(4326007)(23746002)(33646002)(92566002)(305945005)(5660300001)(97736004)(65826007)(7846002)(42186005)(31686004)(7736002)(86362001)(2950100002)(4001350100001)(2906002)(8676002)(66066001)(93886004)(230700001)(81156014)(106356001)(50466002)(7416002)(189998001)(64126003)(83506001)(81166006)(65806001)(36756003)(105586002)(110136003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2061;H:[10.30.19.223];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;VI1PR0801MB2061;23:hBvEfv6l042SfTqRm1DYWR9Zz+P6I/hzOiJ?= =?Windows-1252?Q?5awzHJFKXyQJZ+jO7du69jsMreb6U3luLicH2UMZvIXJ5/Zfi1z9ukM2?= =?Windows-1252?Q?DEgU3qHo9turbxeFAPtRoAwaMlmW6FKtXBmviWxPInHqyF88ic0p5GbD?= =?Windows-1252?Q?0OS4JaPOvz9OAyX1zIOmXfVXNhHBOsIOVab3rP+fyIXnaDlIqCEzjo+A?= =?Windows-1252?Q?yt0GRX6lWcqC/jBlg9HTmHC6itwdg1qi9OsYo628aWWgCZTaCqO18JpA?= =?Windows-1252?Q?VDEzsk5oaiGV5RZM+wfQR+ZiPe3wJ9plkNLK4AhIBJjqr5v8rtB/VMOY?= =?Windows-1252?Q?+QdQ9TCfG7VwhJC6U1JnxsiDqmY0MKv84e7rsPTC87TvBQiGUqn2Pm43?= =?Windows-1252?Q?dhQDj0ovJKnU9ew7LYDKfdedr7bst8Qp7ymkC0ffvCtz5n8bbl5vMm8Z?= =?Windows-1252?Q?rmWgj5rsC68NgxCrVlIF8bJQZiuiCEaVg2ZgKhDvaksJQIVlbTIXMdBC?= =?Windows-1252?Q?1opYN9HOCTNeQRnEViRUlnN8MVaDEzb/VbAbFDtaOPr/JMjvZMPm65x/?= =?Windows-1252?Q?lmRtGlqiKoEKUoXuB51DTUNpDap/zdCBEXVPKnWzhh4gWPulMIf51UtR?= =?Windows-1252?Q?+GtJcCNeEZp/prx1XVWi+r2ZITkxaTyc6Xn+1FEb+bm3p1hR/zAxpf76?= =?Windows-1252?Q?rRAP7H5cZDFXRPQ4hrU+eWx5nur7oLmVpQY+lPRBPqYh+jSruMXvxjfq?= =?Windows-1252?Q?Uqv7ctot+8OMmN9fe0PFy9q1dMB8KUktERjBP3nTOU9Lt1jX4KXtJ01M?= =?Windows-1252?Q?sIG3kHernMlOnnvVscMUWbhI36cdPd1cIEF6f7W8Yxb1Rhi2uU7TgiEG?= =?Windows-1252?Q?MMfrfY2TaJrx0BtEbRPliJgQNhdGHfWzcXKSOAzyjl9048FbeZ35z2DI?= =?Windows-1252?Q?bs91NL4nMHKYPBFek11ZOF/8Rq6Ykf2iaAo94u9vJ1IbdBJhxcC1UP4p?= =?Windows-1252?Q?BAcB8P3uIBv/HTgebBXauSLiPRWCBokn6nowh6cvFxXpgIBNZTSv+ctL?= =?Windows-1252?Q?pe5GzVnmlVd9CMUzAZ8iO02hZtDIX1mAdeKREou7rZ1ydaIJXOyH8Ih+?= =?Windows-1252?Q?2AUgIRyB0ZWOaVgRCO7J4KmLYLAi7rILLI+Csn/kXBsA9B6grlDUXV+D?= =?Windows-1252?Q?eQ5dp+IZwq0tzIxDjaQ5Rs3osHIDolRFgwN/F3DeeQl5NOlEir2SUNog?= =?Windows-1252?Q?gEeekSIYme8U6KtHi3Vs5h64EccIAJqk+NIajime713566XmdD9/Ch71?= =?Windows-1252?Q?wTgF9RRsXbzfnY3pLKh7x+9fjbArpw0aic+Q+/6suAZRatrjCJIYO6rt?= =?Windows-1252?Q?7kFvFjLJtpnlNfADGyeiTPMjyU99H5KvHFAQEtpkgwkcUNTUv1EJW3wC?= =?Windows-1252?Q?hXKKmbRglD8cBHiUWdFiJ?= X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2061;6: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znrhTSR8dmkpctp31EZFkhOb1U+5SERf6TVAR+SKqBFR48o3csHxrmfYhMenMsfOmDDXWLzGAhHjEpaeWA/UZZSFBjJVNaNM1bgZJ6+YTVGR4XGLn3VlKs7YdeLWnrf/1snolI04+6FHpw= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2016 15:03:39.0490 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2061 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1168 Lines: 33 On 11/07/2016 06:09 PM, Christoph Hellwig wrote: > On Mon, Nov 07, 2016 at 06:01:45PM +0300, Andrey Ryabinin wrote: >>> So because in_atomic doesn't work for !CONFIG_PREEMPT kernels, can we >>> always defer the work in these cases? >>> >>> So for non-preemptible kernels, we always defer: >>> >>> if (!IS_ENABLED(CONFIG_PREEMPT) || in_atomic()) { >>> // defer >>> } >>> >>> Is this fine? Or any other ideas? >>> >> >> What's wrong with my idea? >> We can add vfree_in_atomic() and use it to free vmapped stacks >> and for any other places where vfree() used 'in_atomict() && !in_interrupt()' context. > > I somehow missed the mail, sorry. That beeing said always defer is > going to suck badly in terms of performance, so I'm not sure it's an all > that good idea. > > vfree_in_atomic sounds good, but I wonder if we'll need to annotate > more callers than just the stacks. I'm fairly bust this week, do you > want to give that a spin? Otherwise I'll give it a try towards the > end of this week or next week. > Yeah, it appears that we need more annotations. I've found another case in free_ldt_struct(), and I bet it won't be the last. I'll send patches.