Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752633AbdLFSTT (ORCPT ); Wed, 6 Dec 2017 13:19:19 -0500 Received: from mail-he1eur01on0120.outbound.protection.outlook.com ([104.47.0.120]:43453 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752034AbdLFSTQ (ORCPT ); Wed, 6 Dec 2017 13:19:16 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Subject: Re: [PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup To: Benjamin LaHaise , Oleg Nesterov Cc: Tejun Heo , axboe@kernel.dk, viro@zeniv.linux.org.uk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-aio@kvack.org References: <151240305010.10164.15584502480037205018.stgit@localhost.localdomain> <20171204200756.GC2421075@devbig577.frc2.facebook.com> <17b22d53-ad3d-1ba8-854f-fc2a43d86c44@virtuozzo.com> <20171205151956.GA22836@redhat.com> <20171205153503.GE15720@kvack.org> <20171206173256.GA24254@redhat.com> <20171206174445.GM1493@kvack.org> From: Kirill Tkhai Message-ID: <103a542b-58c0-5d31-7b51-2a957a5bbd66@virtuozzo.com> Date: Wed, 6 Dec 2017 21:19:09 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171206174445.GM1493@kvack.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0402CA0008.eurprd04.prod.outlook.com (2603:10a6:3:d0::18) To DB6PR0801MB1336.eurprd08.prod.outlook.com (2603:10a6:4:b::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d3bfe92-906d-44f1-0837-08d53cd5da48 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603286);SRVR:DB6PR0801MB1336; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1336;3:gj0OQ3DwmPzyp8+K9GDmRJHwAYqqEUPEGijBprQCom9RGUQk460ymsMN/xLRF6fDqvlwc/VVxzxqfljC6s7w3E9oPkoX7Ov1s7TVNOYpVVSHksrCV/a910YrI3EvNPOC2uInN3GpGXs8BAME2MEa38Ivh2J3e0vCyIkIi5SzERnV6YpV+Jry0Bq890vEZDwah281j4MXa/y1y6Wnt3Xxz7AeoO3BHHYj846ZpqKhMhlZWu7PHrR8OHhjQXUIPl6G;25:qQjyTtOAjUoiQveaKuKEfq/wUkJCJ8vW6E7bHVxe1vj1tT8ED+RRz178EzgLi9m4jMVB4mye4uVDwOSOuOgiLQ/zZNQHrOq6Seie2UVeX6sSKZsB6KU1ANYBm7AFfbgoEH52lmBTZcpIWSW6kmYlIC371JvGDRr7KvyIJ2Hk9cn6oEleAwbtUolGlayIUaoqQ/e4j7D7mZLENt8nlD2id3vC8KCuJxwO1t34NxS7Az/GFzfafgaikRSVlfxRMGSzTdezHGW9sfjcURuti/jmAzjJ2f0Y31WXDuyEATc7BKdI9UmAKOSdb5ZlXm8UiiZ0/lydlLZWYCZodwvw44LaQw==;31:CkKEriSY622+wDjPt8vPtBTqBHnLksIMRQITZ/RdR5RKVAzx9AxuDYjeh49VvHbY56qx9SL3GNHcNe2Lkf+VVI30pvkNNRIWKgy7CcAjKlW3ZRQP9xWrE3jxAUmueahYJhvMC94qnS0TdOR5Sm9umdCSvh3iwskbuvpzfs0C1X6xUJXYKMXhrsX9fALezTeq6Z+pCp+cVwu/WNRndf4E6xlfnnaRA3tz8tYaRFWA38I= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1336: X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1336;20:ySjymFlpYriYG+n/PomuezTxWFmhE1093+lTXiJD7Rt7YVm8Es/e/2JxiOyK+SR7S0006o/kmZRfDPEaVyLLBwizPuqMLV4JuF37tCXVlvUqLzU8lLHxcXcAm8tLjyadHfndbs8jeoZxBquT4YsDYph/MpSqMi7NKQWeLGmIXpbQRRxk+g4DHPoOuEFv6m68u1Ccq8hyWwkRpkSbuVZsGbZaOIiR2uVrXu0lFAbfNArFffqZxt747dIGyJZKl/qOO1Q/8B6if2NaMK0xtEktaAPjDr+01Kc7zr4MmtWynDJlr9WYRdALbwqZO8OmP310y8PUM4CN+WfKCiOCjB2bymXPbEj2zk53kGgxuGCFsXX3DqWYI6aTMkZboD/B3Dd8JVb6s5eCyuH/QsGyugCKGLRTZdsgHx+yq53ytvmH9wM=;4:e4QDQbPiEIBh6j68RYuKhzqtGi9R+fE849lkms2KGBs+Fx4FRQLhbCVINkQ5c0jhC0pEvnwILH1ujldG5exYXviXtmsWugOZ+m2j4xjc61T+u1KfAsclLrWCrGzDSh+gC0g/KgmG1u1IjBHh/IXwcgd4UqkL0AQLDvQnwjrPLzSsHmrmLG6NFuRp+pdhxw8f/by+lapWCQXqQt+dqaqVnn6NKP9E1nNaHmRYhHjEPtt1loWPC/d15JNk3t5PGHRLAvkpixbEqKUMcwJonKvS2Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(3231022)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123564025)(20161123562025)(6072148)(201708071742011);SRVR:DB6PR0801MB1336;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DB6PR0801MB1336; X-Forefront-PRVS: 05134F8B4F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(366004)(376002)(346002)(189003)(24454002)(199004)(58126008)(36756003)(316002)(23676004)(66066001)(65956001)(64126003)(65806001)(16576012)(31686004)(25786009)(47776003)(110136005)(8936002)(52146003)(4326008)(2486003)(83506002)(8676002)(53546010)(81166006)(7736002)(16526018)(305945005)(81156014)(52116002)(97736004)(76176011)(53936002)(6246003)(478600001)(106356001)(68736007)(93886005)(6116002)(2950100002)(55236003)(101416001)(230700001)(229853002)(6486002)(77096006)(31696002)(3846002)(65826007)(2906002)(5660300001)(105586002)(86362001)(50466002)(6666003)(33646002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB1336;H:[172.16.25.196];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjA4MDFNQjEzMzY7MjM6WUhucWJJeFM4bFd1bGtJVTErVWsvanMv?= =?utf-8?B?Z3dvaDZQUjk5cUs4R1N2OEdnSVNNb1NMQmhYemhsL0FjQVNrZDJwVUplSEFV?= =?utf-8?B?MTZoZEEvcExqV1hQQWIrNDFmaTd1TEtjMkdxSkNmNUJydGhpVkR5aEszMVV2?= =?utf-8?B?YzdCTDdRY0xVSFNYL0ZlRFFHenYxclZNaU42ZTZsL0RVV3hGaENvWXQrc1Z6?= =?utf-8?B?dVpvaTVxd24rMmFwMmtXaVdOMWZnVTFReG5UTTg3bDlhWE15dkFiNmRvMkVo?= =?utf-8?B?eXpzeEJGZVd3WVlYcFNRLzdnNHIwL0MxVmlHTlBTNWRpc0oxQTBUOFRFb1Vj?= =?utf-8?B?b1k0RlRNV0UxaHkveW9WSWNxRnZmdDZIRUpDUDIvUjUyTVJCWEN0cGE1MGlJ?= =?utf-8?B?eW84UFhMNGZoeUlTUklNU1dFa0gyTUw4dkEydE8vNll0OXl4S083SlhveTJ0?= =?utf-8?B?dkFac2FMdyt5clhITmNIVVBlbjh2aFVMb0lRL0NlRG9scWlSSjlFWUpKQVJ1?= =?utf-8?B?UGc1OVJuRWhhaDIwY2k4UTc1c1JsNm1UTjVkVXExenl3ZlVMNXZGajZiRnNS?= =?utf-8?B?N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tMxp6gSlCE7V9Aw7N96Pjtdyh2ePQGNCOVc0LTbNzNcE0=;7:LKhyNBEINskMOMsqaoqxFn3k8V1oPEoEF2me0PJuRrICsfbl5lHMrvwq/zkncFU7cMvWoq2L/tT9ijA8IJZW5kt+cNWjaU6sI9CY+2+v8DcralORsp0i69e7ZFOJ6en5bhiHvWqWNSa+gNpGA9NH7RI1fc1QQK759QqeP/wzHCul55oMYUmwMkZYW+WiWsjB830CAm/TcVZMVthpPYJKSnLemyRGpHiZJrTlx0ZDEkEjtjDvEJoGbz07ZIQMXbSE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1336;20:1aZEsgTSYAz3TkyD9s7OXqVR4A9ziNNGjzmwcWdiMEGAtSkCuq/DSa2xyZO8Ucsp45tUen0pMm8/w/NTTs3n7OEEwUgHCjOER2VeE2U3+3pT6L0hjQEAarlGDAbA7DPBeIjrbuu8vQlvGqbONsHZGNJAiUaZc3P/WeInYBbYu6w= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 18:19:12.2834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d3bfe92-906d-44f1-0837-08d53cd5da48 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1336 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2198 Lines: 46 On 06.12.2017 20:44, Benjamin LaHaise wrote: > On Wed, Dec 06, 2017 at 06:32:56PM +0100, Oleg Nesterov wrote: >>>> This memory lives in page-cache/lru, it is visible for shrinker which >>>> will unmap these pages for no reason on memory shortage. IOW, aio fools >>>> the kernel, this memory looks reclaimable but it is not. And we only do >>>> this for migration. >>> >>> It's the same as any other memory that's mlock()ed into RAM. >> >> No. Again, this memory is not properly accounted, and unlike mlock()ed >> memory it is visible to shrinker which will do the unnecessary work on >> memory shortage which in turn will lead to unnecessary page faults. >> >> So let me repeat, shouldn't we at least do mapping_set_unevictable() in >> aio_private_file() ? > > Send a patch then! I don't know why you're asking rather than sending a > patch to do this if you think it is needed. > >>>> triggers OOM-killer which kills sshd and other daemons on my machine. >>>> These pages were not even faulted in (or the shrinker can unmap them), >>>> the kernel can not know who should be blamed. >>> >>> The OOM-killer killed the wrong process: News at 11. >> >> Well. I do not think we should blame OOM-killer in this case. But as I >> said this is not a bug-report or something like this, I agree this is >> a minor issue. > > I do think the OOM-killer is doing the wrong thing here. If process X is > the only one that is allocating gobs of memory, why kill process Y that > hasn't allocated memory in minutes or hours just because it is bigger? I assume, if a process hasn't allocated memory in minutes or hours, then the most probably all of its evictable memory has already been moved to swap as its pages were last in lru list. > We're not perfect at tracking who owns memory allocations, so why not > factor in memory allocation rate when decided which process to kill? We > keep throwing bandaids on the OOM-killer by annotating allocations, and we > keep missing the annotation of allocations. Doesn't sound like a real fix > for the underlying problem to me when a better heuristic would solve the > current problem and probably several other future instances of the same > problem. Kirill