Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935769AbcJYFaW (ORCPT ); Tue, 25 Oct 2016 01:30:22 -0400 Received: from mail-db5eur01on0093.outbound.protection.outlook.com ([104.47.2.93]:19680 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754133AbcJYFaT (ORCPT ); Tue, 25 Oct 2016 01:30:19 -0400 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> CC: , , , , , , From: Andrey Ryabinin Message-ID: <25c117ae-6d06-9846-6a88-ae6221ad6bfe@virtuozzo.com> Date: Mon, 24 Oct 2016 18:44:37 +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: <1477149440-12478-5-git-send-email-hch@lst.de> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.10] X-ClientProxiedBy: AM2PR03CA0023.eurprd03.prod.outlook.com (10.160.207.33) To VI1PR0802MB2560.eurprd08.prod.outlook.com (10.172.255.138) X-MS-Office365-Filtering-Correlation-Id: 35e8247b-227c-40cb-67e0-08d3fc24a179 X-Microsoft-Exchange-Diagnostics: 1;VI1PR0802MB2560;2:vGZFS4npLIKPi0x2Oi7LT3VRYaRi7znoxwjV2LG/dBYWars07+08bbp0uZwYT/eA1LYXXhMRrP1JTF7mwRhefEWr5rO5nnAdWpNowkxIO+qQ4VBW7zD2iPRP6N2oR0jrye4BhubxiBO43J8n528L0cKcTsElDFOAJAzYE7UOo0OZciLwFhXJ/k7b6PmqQ4AKhpJDbEexAsCoBA/Xg32cIA==;3:akcZ6AmL8uuZ26+33w4oDL/QY2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l61QpqT5jrtAM5z30q13eD8UCDdKVIkCw0CsXTRp39gzyv7xlls7YKBy5RJ7B8WhMYPckv73zCDv8YXp2BO6LMEb+dPN5290+eWBz5JGi0YpkACq6XgfOTVnJLmw1X0T7BesoXlUzmCbGep1/OSFxB9IYrVNKoOJTX9sc50LcaGdngrCVYd9eTJLJVS1OJjMbb4KKOnqqpNwSAg6ztmJ85tyCoUnnw==;4:Hz/2rsp5fnMkX6KrV922BLihr/JLVic2RnmoC6nDow5eAwMsBCWSOItIqFO/8rZ3BfvFCz4DsXy4OzLU5VnqXGzv+L9aWrQ+QZ1TXgfeo+/N1xBRsTB3HPkPYLRbKvqQSr1rYcf+5Q5n6NA0b7yymfHphO+SqD5IYrtShujzhkXAXBFfqrUVSgi3gx12q8yrs07WPofz8rBxP3/BgLM1jJlIPde7LJwb/OxYRBdH0ok0H334ks51voYoPNSQtQ5RrcJplYvZkctgdTrxe40G7ls241vInUVVomzP6VTXxh7Az/PotvJ+mkQ1RbfORqq4GtkbP/g45FsSk8WYuErzrUum6Pb8zU98M23mB4MbhJiO/t+mc/xsWDKI2SgPDNfERC+19sx9w11UySS7ZJvwoHqhgjNEgVrnjZuMSQJ5n8wblyOQig+HzUlLMenVHuUD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6043046)(6042046);SRVR:VI1PR0802MB2560;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0802MB2560; X-Forefront-PRVS: 0105DAA385 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(24454002)(199003)(189002)(377454003)(4001350100001)(105586002)(101416001)(6666003)(50986999)(76176999)(54356999)(2906002)(64126003)(81166006)(81156014)(189998001)(50466002)(47776003)(6116002)(3846002)(19580405001)(19580395003)(4326007)(586003)(8676002)(65956001)(66066001)(65806001)(77096005)(86362001)(31686004)(65826007)(7846002)(2950100002)(42186005)(23746002)(68736007)(31696002)(5660300001)(5001770100001)(97736004)(83506001)(36756003)(106356001)(92566002)(7736002)(33646002)(230700001)(305945005);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0802MB2560;H:[10.30.19.223];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;VI1PR0802MB2560;23:Kqm1aEvPwcnrDZuQ3vh4nFeyqvPykrhjF5n?= =?Windows-1252?Q?g25wRFJdMA2qe2wgcDR0IlnfyPqK8hgYzAp8GhOSr0w70jWnh/kYLKyk?= =?Windows-1252?Q?ZKGffb6TrR0YPYTUydNkBEo0Y2g5J4zjywIr/4Qth5iNxFXbAkkR58kY?= =?Windows-1252?Q?xaVAcOjITo1uIWMjdGmsGp6Nb1gZG4qjMKFKTLGAIF+NMPY+3Vt7RJNz?= =?Windows-1252?Q?J9sM/E7++VI33fHd3v1DbfBA5bpw8BXG+zSP9WsjRfmXE6YBfrpMbmwW?= =?Windows-1252?Q?H9MExZdb3p1sbEtm0MC6uXQcEfzR/9QmOar6lBMg/AjoBem8bzk0evKK?= =?Windows-1252?Q?Zm5VpXtjEzoznMYf6vqxqKpYEufnpWUg+KHqlI1rtLJRnsc5s2hLsjVc?= =?Windows-1252?Q?R8ChPb5HOHkb71E0MEo+x29fdHgbXSSYpn+kC+WygsYf3jA8G5e3Rwie?= =?Windows-1252?Q?ZuLnB9It+E898Dt9UAJ7FoAUsedE0B3rkihWncpyRih5ehDoAeXD71SK?= =?Windows-1252?Q?xybmQ22SYZE19oKX/ibGkhtDnW9jt77ZTWC4yd6oTDziIKEE55cHe3Ow?= =?Windows-1252?Q?5bGJoTZfwhmvYw+8I1fKAIDO3hOMzNpGlbmvxeZPYAqMQ3qyFF0XnhSb?= =?Windows-1252?Q?pSWcKqTHqb7Tb0jUakiHq+GI7ivH0UdWqhBEMMPtQzl3Cahx2BPMOHoE?= =?Windows-1252?Q?DxiVdcJlVI9dYUnxtr2aXWAeoC8q+AEU+VmTRjlS5zz4EClPL4lnr/WQ?= =?Windows-1252?Q?aBjnHFtumFOeGhroVhFxlt/xxE2jwO0JNN6bPwwzSVeOZaHN/L8mipZ4?= =?Windows-1252?Q?XjZl5XpQ/EyS4hFBkO+xiIes0MLsW4CKxdXmszReJ0OGnSeliAhJp2od?= =?Windows-1252?Q?cU58P6qDIjR0u2h30Vc9TTHhrDsCzT1FDxHugXHzWgfeWHl6/6rbw76o?= =?Windows-1252?Q?GNl5V7/v4ZlmjGynXzEk4AvkFtgedkL515h3qIv6u65S3kZtJBghedmv?= =?Windows-1252?Q?bnxGc90XEyndpsfxqpwOUeDK9nvIyEv3bobIak7bijLkMyDz111yZBlp?= =?Windows-1252?Q?1Qx7LAHVSO83k63CcfMBUXKhgidTocrJKDbpjL4ATc29qe6jwN+K98Or?= =?Windows-1252?Q?wSvgyIrvHG2tbqAXN5bueCx/BswxG0pSD/737yNUq3/89oWnU+2vpKNb?= =?Windows-1252?Q?CD7twq+HXe5nDxdtBMg1MUacmQSiyBZpFnGEu+z/VezBKEp2fLvwRaDa?= =?Windows-1252?Q?2KvjgkYWeXpS9qxMWCEGODTNnq8SKRavQYZuVfuR8zto38PPn9TBxaqt?= =?Windows-1252?Q?WyQGZrx7E/rfZrnYUChZIpKuV7pTv4Q93tfEiiXB5PvLdZyYojAaCF+X?= =?Windows-1252?Q?trVfabfsA97mDtbUl7PfZVUFTaPyjXFKLSEn5rdEKv/hlKLhDicZVg9g?= =?Windows-1252?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1;VI1PR0802MB2560;6:QZv4RDxBhnJ9CIb8R1LFZNGtAONvkngmWZx+kMbSrjD9oyjrI6ync9Xhq9hgxgOssRGpgabSqpvrye72sZ5QD5PAxYJdDxgzSIMKwIhlsA88XDTjxpWYumRG+Tyx0KfzgSaeUyex9UN+odhx4iulgPXMjnuwLT31h9/2QLiXl34z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WqRIbEAlC9sCvu/HLWjcjMU6TsIuC1V26VJS2aEDDODYJOJDchqe9y6noL54O4CWc826G/RlIDbphMm1F8iA+iq1jm0bExBSoP2jDUpSECstbT4/LHDe/wMYbXx53WrrCdnQpL8SQ6MG1Ow6AYShBaDFoEtFcoW+kFgfDSlDVUbqzM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2016 15:44:24.0176 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2560 X-OriginatorOrg: virtuozzo.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 962 Lines: 30 On 10/22/2016 06:17 PM, Christoph Hellwig wrote: > We want to be able to use a sleeping lock for freeing vmap to keep > latency down. For this we need to use the deferred vfree mechanisms > no only from interrupt, but from any atomic context. > > Signed-off-by: Christoph Hellwig > --- > mm/vmalloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index a4e2cec..bcc1a64 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -1509,7 +1509,7 @@ void vfree(const void *addr) > > if (!addr) > return; > - if (unlikely(in_interrupt())) { > + if (unlikely(in_atomic())) { in_atomic() cannot always detect atomic context, thus it shouldn't be used here. You can add something like vfree_in_atomic() and use it in atomic call sites. > struct vfree_deferred *p = this_cpu_ptr(&vfree_deferred); > if (llist_add((struct llist_node *)addr, &p->list)) > schedule_work(&p->wq); >