Received: by 10.192.165.148 with SMTP id m20csp697610imm; Fri, 20 Apr 2018 13:59:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx48b3Lkpfyq/Oobvri+Z8uAVkPTxVCUz71FnEF5kinCgum0Hg4gIqlbvJsRZpHipl4cW24FY X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr11599084plp.367.1524257959765; Fri, 20 Apr 2018 13:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524257959; cv=none; d=google.com; s=arc-20160816; b=x9+JJL25krnvi6wjXge9e/iKFtOdDOJvRRqwBU1PlzEaKzBchEMnYjU1tdv8Iy8sTQ woubolpfkZJ+5fL9n1kIeKe9AMNVgRP3qjfw/GTNHH5ZtaFz/QMXOSnL+GRJng+JSrjG RwZPDunvh/VTLaolD0iSQPVLVCTdZvtKe3gx1OZ7wAnx+pakmKnGtgkeFcFF0z4gEKky 0gyI9OY0PyY7L3eUTOlMrvYwNtPMvpykXPVy/j8b5wZ5RjNan196CfwboSvyivWSLjxi vLcU9yW9A057453GZXuQHNmW0bp34ZW3iRDJy6z0o910KtS5AO9oDY5Ea3iKmqly5fWH 5Skw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=6neX4/M68Q4TrmlazYho72sfKPBe05d3nZoUUy+AxeI=; b=pO0sjXXrTgQOSWLs0Tce1RSU4VtVEzQFKoUJvdZNBCL8E06z48Kqi2VqNlsonwKA2T QbCVmsDR4/t1sAoZ5WJMqt+LY8tPmyhLpwRKhWLP67+W91XhTiv3pDNch+1MWS3d1Uv+ SEhtVyvvIzVBOLbT1POboA0dOaPJKCxbDcNlyMVrHS6j3MBFX3tCwWfK9BSNWBoQIk/L b4GemKN9dHkB2bKPd5Hc8CR5pwIYda++PcJd0tiYz69cKp4cZxgV6Q4B7sUYAlhaCi1C KKIcpvfLw5untvktOXcuOqZ+mXMoW6/WBJuKBbeBBjTG6czp71W5hpdj820/UEcM9z71 8c2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4-v6si6251543plo.316.2018.04.20.13.58.42; Fri, 20 Apr 2018 13:59:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752946AbeDTUy4 (ORCPT + 99 others); Fri, 20 Apr 2018 16:54:56 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42812 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751860AbeDTUyz (ORCPT ); Fri, 20 Apr 2018 16:54:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D2C24072CF9; Fri, 20 Apr 2018 20:54:54 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 29D122022DEB; Fri, 20 Apr 2018 20:54:54 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id w3KKsspN028632; Fri, 20 Apr 2018 16:54:54 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w3KKsrGT028628; Fri, 20 Apr 2018 16:54:53 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 20 Apr 2018 16:54:53 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Michal Hocko cc: David Miller , Andrew Morton , linux-mm@kvack.org, eric.dumazet@gmail.com, edumazet@google.com, bhutchings@solarflare.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, dm-devel@redhat.com, Vlastimil Babka Subject: Re: [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM In-Reply-To: <20180420130852.GC16083@dhcp22.suse.cz> Message-ID: References: <3e65977e-53cd-bf09-bc4b-0ce40e9091fe@gmail.com> <20180418.134651.2225112489265654270.davem@davemloft.net> <20180420130852.GC16083@dhcp22.suse.cz> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 20 Apr 2018 20:54:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 20 Apr 2018 20:54:54 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mpatocka@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Apr 2018, Michal Hocko wrote: > On Thu 19-04-18 12:12:38, Mikulas Patocka wrote: > [...] > > From: Mikulas Patocka > > Subject: [PATCH] kvmalloc: always use vmalloc if CONFIG_DEBUG_VM > > > > The kvmalloc function tries to use kmalloc and falls back to vmalloc if > > kmalloc fails. > > > > Unfortunatelly, some kernel code has bugs - it uses kvmalloc and then > > uses DMA-API on the returned memory or frees it with kfree. Such bugs were > > found in the virtio-net driver, dm-integrity or RHEL7 powerpc-specific > > code. > > > > These bugs are hard to reproduce because vmalloc falls back to kmalloc > > only if memory is fragmented. > > > > In order to detect these bugs reliably I submit this patch that changes > > kvmalloc to always use vmalloc if CONFIG_DEBUG_VM is turned on. > > No way. This is just wrong! First of all, you will explode most likely > on many allocations of small sizes. Second, CONFIG_DEBUG_VM tends to be > enabled quite often. You're an evil person who doesn't want to fix bugs. You refused to fix vmalloc(GFP_NOIO) misbehavior a year ago (did you make some progress with it since that time?) and you refuse to fix kvmalloc misuses. I tried this patch on text-only virtual machine and /proc/vmallocinfo shows 614kB more memory. I tried it on a desktop machine with the chrome browser open and /proc/vmallocinfo space is increased by 7MB. So no - this won't exhaust memory and kill the machine. Arguing that this increases memory consumption is as bogus as arguing that CONFIG_LOCKDEP increses memory consumption. No one is forcing you to enable CONFIG_LOCKDEP and no one is forcing you to enable this kvmalloc test too. Mikulas