Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757711AbcK3S2S (ORCPT ); Wed, 30 Nov 2016 13:28:18 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:59156 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754021AbcK3S2I (ORCPT ); Wed, 30 Nov 2016 13:28:08 -0500 Subject: Re: 4.8.8 kernel trigger OOM killer repeatedly when I have lots of RAM that should be free To: Linus Torvalds , Marc MERLIN , Kent Overstreet , Tejun Heo References: <48061a22-0203-de54-5a44-89773bff1e63@suse.cz> <20161123063410.GB2864@dhcp22.suse.cz> <20161128072315.GC14788@dhcp22.suse.cz> <20161129155537.f6qgnfmnoljwnx6j@merlins.org> <20161129160751.GC9796@dhcp22.suse.cz> <20161129163406.treuewaqgt4fy4kh@merlins.org> <20161129174019.fywddwo5h4pyix7r@merlins.org> <20161130174713.lhvqgophhiupzwrm@merlins.org> CC: Michal Hocko , Vlastimil Babka , linux-mm , LKML , "Joonsoo Kim" , Greg Kroah-Hartman From: Jens Axboe Message-ID: <0c7df460-90a3-b71e-3965-abda00336ac9@fb.com> Date: Wed, 30 Nov 2016 11:27:43 -0700 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: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [216.160.245.98] X-ClientProxiedBy: MWHPR13CA0047.namprd13.prod.outlook.com (10.173.117.161) To BN6PR15MB1185.namprd15.prod.outlook.com (10.172.205.139) X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1185;2:DEot40iWVU5Dxwo5F0fmYTQkkfKkvpUsQ9c/fqVDi7ruyXDtb8mnJTtz+qggszNrmKOtyrL5H/L8B5WpQfvd1kOrTh/7WX86YLoK49aL6o3apR0//BWYtTtW2sAqdTLd6bvdz2tNsOTjHUFjwqkFwMluQbhVZnMd7LrfdEG6Ei4=;3:ah+46wUSm18FSYjNalvQtoXWi0ZBl02gOtZK+HF2iEcoJhbbPmPAVPLkxogKlFHpkuhBLK4roP8sYIyIXT+Fsbom+MXKGFk/dRnI38tcqnjHzGbi2RrG3REk8/MZS54jELkgakufhpHSYVj8wFe55CNu9fu1bXUSBJiKY3I3SCg= X-MS-Office365-Filtering-Correlation-Id: 4dab376f-c582-4eef-79d1-08d4194e9711 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR15MB1185; X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1185;25:U/7hljmAr03hXTI5BwkLno1vq7GqP1PxiTTtaztzxFEeGsgfQ5KtO+iHxg5KPhlzbnXfGwylcUOC0GsGEl4XnhB1jchIv9r3yvC7zY5XGR9IbTknttVOBtg9/6N+pC/jyiwdG/4CvJ5VSJdrkFGFmwJUGwHu5y2v8TLfJHGtpVZnlo+D/65dmOOtRqG01FI5w/WwyjLt023cdIpINbuw689o3Us7c0EBCh8yUYO8AcgFmTjBzfn3hoX7xy6KfXSn/uLxSWNfADpCOoJZ5ssDlPRiEjJjHd5b4G2FA6Cr7LXwhqnt04cuaUVKr7IH0QKaV6xYqBdQ/tHxvNkkyPEgzdZUV8G1vYpv6v0crodwkGHHfway7UCLWdYoOWPbjHL1uwg3HH7m7gFcFJPyH2vXFRy+ccGLubGPDO68Q1Z4HmmgDXZ5y6gioNqpEX8EMKgCSGRgX5rEqkFQi1Cza7mdex3SCBrnHVO4UchCnfm00WHpgBfB5Zs70NKV837Ukr7zWffSL6Bov+caEa8PP+KLRhVuCCCaMYrrl69m7f99rSZTouc8UTlK86HWx0sCFKtzpnYN0lGkoCI7JXMDj9sOKzfphB/OCM35+OxleYnF8vJ/hah+uus0pDu2aDw1HxzJDrDN6OlLGrLU9uXdz7QUCir486GazE5MJvFPB0cXYkrGkifvR2OV7TV+XLTIw42o5o+QDPMHymmuCcAGr4r0Kv/WoGNYDFCMgJDBB++CYIUihC0W751dxdj2qLHrsGbgQvBdGjcNmjSzLQ3IPu07BQ== X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1185;31:NoBNHOskeoTECzLdb8GmhJ+AajFFRGKc4UcLkf9dK5GW7ECDgTzNMVm0qMt8QfyMRLjz9XWEBpaj0aL/JVMIo/MuyjfzS6UeFABMVfRtAHNDWq75mxw8YWMezZgIeJN6/LglhML2GGhNnl/cTRT3Dp6VZ/j4mC6NNDVbJ8JY+3bpEHH7Y/GK/BfszEomviOtxUcyi6pcnxGk6oG5fIqV4slZw7vceDDJWJuhQHt+RSsn5KipWIn41eBmXJ2vkQdG0jcdgdc9dL3C8GXWtwVkWA==;20:xf3AZCM2h/BVKF71UFLsDWC7206ZDbu0kg9X3ZgCnhkGjaUU/6w9Cn0UbzU0lXs1AsWE05CPCwhxDkQlmayPpEAY0suh8HRfnHLtU/iWUSwjAsIpZftYxEPcl4pKXq+dXFaglNLa6ExbWDFzODRFNn4FFGZfXGh1b4ahu9JJh8MdvnpP64ygPl25CpnFct6Z3NjkQ2eZu8qxybjZviZOuPyzMYJNNNR9V6egn2trJKt/X+HCqbC+UwE/fy01rMSD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123562025)(20161123560025)(20161123564025)(20161123555025)(6072148);SRVR:BN6PR15MB1185;BCL:0;PCL:0;RULEID:;SRVR:BN6PR15MB1185; X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1185;4:LKNF7TkE5xEUz7DFnjRs+0bW+nzWcJrbthBXhvu/Wi1CNVmipUj/gb11BHvmyCcPt7Y3uVVG8RW2IaG0LCXe2XuI5QNyqLwSiIn+k4I70LJzMOF3M7yg9+BsBVZs7ZZW11CP/9r1rM7kT6B3j5d0+eAgMx+Nab0XhVAK8gzUvMQ70++vHBT3LbqV25jsmwqkv3xR+u+jEcKmuR1KPgxUnj4JzIJxicmJQTBf5tvyVpwTu2rpLzP2kqJk6NNxeMaDSkh8lrt1VdnpIV6wsLEeuHdSNTduVWNMEMRCKAAXEOIDAqOtBamu+3ENEMn4fM6ZXf7er6PT+jGypyfIwMDnL2s/lsMD4KV6X83tLRtjmDZJj9+5HvhATY+TzcZmMAUjsrD7R1HL/8qIlqF6PeRKCyxuMo+q5+q27PBSAktk3ANk08xiK8KcNSJHaa01gmDfw8hZWgos/6gDkenU/V2MARtG85+o/qMgWz880mM8D3MM26v94fFUiNsqmKNqZjP2EQilYfnBVi/JvUmbBUGv8Dxc92Z1lE0TGJ22Ytj5ba5h/g9dBxYi+lhYCqiaQ8dm X-Forefront-PRVS: 0142F22657 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(7916002)(377454003)(52314003)(24454002)(189002)(199003)(4001350100001)(83506001)(8676002)(31696002)(4326007)(105586002)(2906002)(31686004)(7416002)(117156001)(36756003)(65826007)(42186005)(76176999)(54356999)(229853002)(92566002)(97736004)(64126003)(5660300001)(50466002)(189998001)(5001770100001)(50986999)(47776003)(6486002)(65806001)(33646002)(7736002)(6666003)(101416001)(39410400001)(230700001)(2950100002)(65956001)(81156014)(3846002)(86362001)(38730400001)(23746002)(6116002)(93886004)(733004)(305945005)(68736007)(39060400001)(77096006)(66066001)(7846002)(81166006)(39450400002)(106356001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1185;H:[192.168.1.129];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BN6PR15MB1185;23:/x+p/v1tWJB1pECArMOM9lJQU0ET/yTtSOsDH?= =?Windows-1252?Q?7fkSkfWRw48VffXBuDxkCshMBeZH13KbTMAA9hkUe28NWw06FCNuBS1T?= =?Windows-1252?Q?V5h6pwSQVEmfigefDCCDi3aBo7RhMM0Kr0Cpc2FsRANJG91ZupEm/dHT?= =?Windows-1252?Q?wb2YflOBopS+YfS1JGsDnGCXuMLBkXTbd6o9AsTnexaJmFOEL8AzjUsb?= =?Windows-1252?Q?PIcUbPVD8MlK95ly3QptzSCBNtF29U+DyHRpx7R+pqQZwBQkJLqciwNv?= =?Windows-1252?Q?9oOYKXnbTKtdghivsVV4d86Q8dK9Z2kmKLA69eZEJ1dFkmnoILyGP1QW?= =?Windows-1252?Q?UKcL9c+Oa9sHQ7sc4KpSFMU0ye6CFkxLUwbYxpbgoMSH42GXY82AFDLu?= =?Windows-1252?Q?9X0wtR2TM+M4itXR2nUOJ5g53wYI66bvYqfdr4BcWJWSIw9jOgTttph/?= =?Windows-1252?Q?3y59CUM07eeWJe+b85I+oiaTKDDQcraITwNYlovDafftTgmlShiLKuCu?= =?Windows-1252?Q?uylrfPxJqjoDIBZpdqtBzy6RCeHlEEJR4Gqzx0gx9pFyO8XOnA4BHBqJ?= =?Windows-1252?Q?F6Oi3+jCLhv1WGlq1llWdXlC3W/g5MjqJWacmnhhVzwfuAFc4hFIEMnF?= =?Windows-1252?Q?2B2V29Lhu1q2D9KfzP4Yl6dhX8OK5pLbkQ3P3mgOPFBcGIMaY5F+VLu2?= =?Windows-1252?Q?51J7KgiQz5pYGwpeH57eQRGfSJ3E/59EgvrHy8NiOTSB1YVis3LAge+l?= =?Windows-1252?Q?69fhv3svYdCXnXstDSQaHwkiAjNzvQNPnULsX/Rd6z/s0ut6Ga1AESwg?= =?Windows-1252?Q?HBS4YsNnajsmxQ35LV5pML7xo434/AeD/Oom6SKqfM11fu0dr1HNtz7r?= =?Windows-1252?Q?sbbN5xD862yxajGRQoTQtY0MJOPUukMpR+JsflnqKDNc7uBv1fhV5PVj?= =?Windows-1252?Q?STJZe+lK2VUBXK0ViqmdrOPdhY1hR6uHuQK0sWxjFB0pSsA2dRlMjX6P?= =?Windows-1252?Q?AGo+oQSf+6+hKIwHD0oLeuDGwbTqHIa39TGWyPPmcbVT5kk58vbfjAS8?= =?Windows-1252?Q?ceJcMvY9pT2CNYXYaH6KEi7viZdQ+vXW4HNAn62gioAXYHrEhGgUvzHl?= =?Windows-1252?Q?3n+M2tY4a1EO4LNXd+eOAGasxG0DDf/hpPPhfNGeO0mDLLqSyv4HTe4c?= =?Windows-1252?Q?0493TyBnXvUB/efXo+zIFQoQ0kn7Z1vSRxqTEi8xWM+AAuNbJMKViZ1B?= =?Windows-1252?Q?WAmVzwMVbm9ndnL+jRkl8mTNfhc03wLhV5qBVCtrKob6vNAapQ5ikkPu?= =?Windows-1252?Q?GmPvpeXf/UpNsWgvuy9yUzJxDa/WTH/gzdvImNcfbnKl7YEQMVn3128o?= =?Windows-1252?Q?WAdYcOeaRmtbQ9EdVMk5xCPG892y+1IgdIzc4OWtTPg5QBr5fdeNTmgi?= =?Windows-1252?Q?vEXoOBHmQf+bcw3Pk7jO4NcRAsTqHJQsT0Qdk+TSYWpX2e8OFk9Ic8wS?= =?Windows-1252?Q?Mwr8I1NasUD8P+WWy/g+47L1W0ilXR3D8Mv1+1Dfmy+OqUT3yMx+EUp7?= =?Windows-1252?Q?B4CQLClbnEAYmWq41nimMYPyo5R4UbBvjMLu0YgCVeygOq/peq3uaYrz?= =?Windows-1252?Q?uwT4lK11499+znaPEuzQR0=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1185;6:zXXobMZLRi6RlGK+ZWZKE+hiAo4iqUARMJxs/MQE2LgP7Zmlg0G67K2rksvsD7/7whLNNLtJai9hGAmOtilluDpjJxJTGvdGWh30jw92MECSK7alfhRy1msgvgjutqPz9g8ccr7wcCMGLALFnFIx2lur8CZa8a1B05gvNF7UH+a7dxOForKjKXlR46CvocBj1OOFXwZ14I556+Mo4pYD3b0/dVwij+EIunANhwleQbAFVutO5kDf6oY3EHSA8iER/yDI2p9IhjesXHUhp6e0iTaQZg5zwprg+oGfWcjrlr+sWi1DIoM3ofrCcmPFYiZrvlX9IJ0Pa1pmxX3PUDK6HB40bq8Vyv5mIV6vhc0Blzg=;5:v4wfLS3akLdGbnxeNP449mbhH8yxe9nqisigD7FVRamgERr6ihUchJa5+X9AYKED2atKaO98L4MWPRuhQw+zUfiGwkEzUzlu1EYoMLMkWfOYpRG0mWmHWwovoL1Z64tNihlepIlah4SQUf8/2JvOFA==;24:D+7ohnJgIwnniJ+k68QoilLx9vVXZpfDatFxSrDynUT9+1I5kTECCKBLtsNLbohuvo2dJWz3zfQCRmlysNOLXACqmABkOEH+yfWRkwEsbp8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1185;7:TS3tqAkzrkwPBF2OWC3Vh4zqv3i28+klw//ZH+4VecZ4+wwf0zEsw4TrXz48O2fYqi8h2y+iaAS5H191ZSmp0LLDBqAkHWHRugHvppoFd7MOB5ACkeeQ+j+bmmTSJubKb5bfmGRfto+6ooQku8fJrQVlHaMdTfvGQMqPLq7NmfyUfFogmYImW8QABXdSyYZhGT9RYc6CsN30DdLY/Hjgk5cpYFz2fCLVro+P3+iVLovCVL9szu3lqeTDrRKW9/L9Rip6BEvcqiXsHI379vqVqIrRTPn1MFVgwVS/acJGxIItXvAknPD9P4Rf0SA08XzSkPkOasNkvv5JZuzt1ehmmQ9MlVRBDbRedJvS8Oyidi4=;20:6JH944EJrklr2KvsqK8vAcmXKFhj5mn3y9PP5bN+EJHKkVSRL6M79K2hle/ZBNLlB2iVDo0uVoymHunB9JzbOM6UfNycJaK2GmT0W6XIzOqdoY8Z2FMlt1caMQ05JXV2Zy47Lql1krYZfeSI+qUI+221bBMV9ayjXjTog5zuye8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2016 18:27:48.3828 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1185 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-30_13:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1966 Lines: 42 On 11/30/2016 11:14 AM, Linus Torvalds wrote: > On Wed, Nov 30, 2016 at 9:47 AM, Marc MERLIN wrote: >> >> I gave it a thought again, I think it is exactly the nasty situation you >> described. >> bcache takes I/O quickly while sending to SSD cache. SSD fills up, now >> bcache can't handle IO as quickly and has to hang until the SSD has been >> flushed to spinning rust drives. >> This actually is exactly the same as filling up the cache on a USB key >> and now you're waiting for slow writes to flash, is it not? > > It does sound like you might hit exactly the same kind of situation, yes. > > And the fact that you have dmcrypt running too just makes things pile > up more. All those IO's end up slowed down by the scheduling too. > > Anyway, none of this seems new per se. I'm adding Kent and Jens to the > cc (Tejun already was), in the hope that maybe they have some idea how > to control the nasty worst-case behavior wrt workqueue lockup (it's > not really a "lockup", it looks like it's just hundreds of workqueues > all waiting for IO to complete and much too deep IO queues). Honestly, the easiest would be to wire it up to the blk-wbt stuff that is queued up for 4.10, which attempts to limit the queue depths to something reasonable instead of letting them run amok. This is largely (exclusively, almost) a problem with buffered writeback. On devices utilizing the stacked interface, they never get any depth throttling. Obviously it's worse if each IO ends up queueing work, but it's a big problem even if they do not. > I think it's the traditional "throughput is much easier to measure and > improve" situation, where making queues big help some throughput > situation, but ends up causing chaos when things go south. Yes, and the longer queues never buy you anything, but they end up causing tons of problems at the other end of the spectrum. Still makes sense to limit dirty memory for highmem, though. -- Jens Axboe