Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753193AbdFRW2B (ORCPT ); Sun, 18 Jun 2017 18:28:01 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:36374 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752678AbdFRW16 (ORCPT ); Sun, 18 Jun 2017 18:27:58 -0400 Subject: Re: attempting to format brd device results in OOM kills From: Jens Axboe To: Jeff Layton , Christoph Hellwig Cc: Hannes Reinecke , LKML References: <1497803428.21567.4.camel@redhat.com> <7e8cdef3-7062-0a11-63c1-e19fabcd117c@kernel.dk> Message-ID: Date: Sun, 18 Jun 2017 16:27:55 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <7e8cdef3-7062-0a11-63c1-e19fabcd117c@kernel.dk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1736 Lines: 50 On 06/18/2017 04:21 PM, Jens Axboe wrote: > On 06/18/2017 10:30 AM, Jeff Layton wrote: >> I've run across a regression from v4.11. If I boot a v4.12-rc1 or later >> kernel, make a large brd device and try to format it, it quickly slows >> down to a crawl and then the OOM killer kicks in. >> >> I ran a bisect and it landed here: >> >> commit f09a06a193d942a12c1a33c153388b3962222006 (HEAD, refs/bisect/bad) >> Author: Christoph Hellwig >> Date: Wed Apr 5 19:21:16 2017 +0200 >> >> brd: remove discard support >> >> It's just a in-driver reimplementation of writing zeroes to the pages, >> which fails if the discards aren't page aligned. >> >> Signed-off-by: Christoph Hellwig >> Reviewed-by: Hannes Reinecke >> Signed-off-by: Jens Axboe >> >> >> I've been reproducing it in a VM with ~8G allocated to it: >> >> I have a modprobe.d file with this in it: >> >> options brd rd_nr=1 rd_size=1073741824 >> >> I then just: >> >> # modprobe brd >> # mkfs -t ext2 /dev/ram0 >> >> It keels over pretty quickly after that. > > Just checked, and creating a 1TB ram disk and then running mkfs.ext2 on it > writes 16851MiB of data. I can't say I'm surprised you OOM, if you run that > in a 8G VM, as you're about 8G short. > > I'm puzzled as to why the discard change would make any difference, however. Reverted the patch, and I see identical behavior. The only difference is that the whole device is trimmed first, as expected. But it still writes ~16G afterwards. Are you sure this commit is what broke things for you? Honestly, I don't see how it could ever work with 1TB ram disk, 8G of RAM, and 16G of data written. -- Jens Axboe