Received: by 10.192.165.148 with SMTP id m20csp4818184imm; Tue, 24 Apr 2018 08:53:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+AEs5q33xdDnY4XZbc9Ct/U1Sxxcb5oOZtBDWTpdq+ovVb+2gt3hYIEXIQ16yE8KgnHjkA X-Received: by 2002:a17:902:aa94:: with SMTP id d20-v6mr26249761plr.323.1524585189083; Tue, 24 Apr 2018 08:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524585189; cv=none; d=google.com; s=arc-20160816; b=Y7NaeFbB88HQfG1U1+yXDZUJlZMS1GEyIRylKM4RC3BJlhvFSczLio0VaxQPKbWOKo MrMzwkIYwYOkAh0XLZLm8nGMAf4MDLpHtftTmoUQkLtOWVn4vlDdaHDRiAHkUfAQe1m+ PZIVMyF8p766rOIcF6UTB1OuVoM4ORcYw0sUeiAD4CzbfR6MboGOSqYzRdaEcpV1imgI 3/kyYaoNuvgXxDclgDNrGxErIU2F0ztK7awJ4jJDrNAgJu/5OsLT+Cwg1gW52Ht7Bt4u ZcVhKC5Vueqd86cWbwrjthJB9PeN/O6BQzF0MhHfPQwMougxFyX7L28PtIkYMe9Fg856 IaTQ== 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=yCP3t/CtMf71uiSRaPRX9/+b2DilSsFQ2SvnmqXF+mQ=; b=PpQ5bEWdROEw+Un2LaE9R2VnvKbQpPwrRxwWToH0qaNijQgueeWsKBmtYTAedZTUhs +F435tBquCgcXawSwO/4k5pUPy6LgxYUud3M+iSPnmKnVVt+I23TGCGlTDGyRXUn9ZsA iM8t3/L6KK4sqVa1UpdRfXv/bc4AXZhbHWqb2iwfQzo31vN+mN57IYMyB7Vui4IxJVuY 3mJseZviLjQZHzOq0BMKpggGMrcVY6Fd8goE+1BD88CN8XrRPU52Igvn9tC41cmNvYx/ y3UmDYs+qPRo1VCWOUngZsuxxV0lCEUh3yv+oqWNB/NaJphfQF/OibNP2W4cElPAqKgv Ob2w== 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 b4-v6si8990225plk.327.2018.04.24.08.52.52; Tue, 24 Apr 2018 08:53:09 -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 S1751469AbeDXPuj (ORCPT + 99 others); Tue, 24 Apr 2018 11:50:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52658 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751362AbeDXPuf (ORCPT ); Tue, 24 Apr 2018 11:50:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 911A54270969; Tue, 24 Apr 2018 15:50:34 +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 9BE6F6353E; Tue, 24 Apr 2018 15:50:30 +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 w3OFoUmV017220; Tue, 24 Apr 2018 11:50:30 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w3OFoUOZ017217; Tue, 24 Apr 2018 11:50:30 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Tue, 24 Apr 2018 11:50:30 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Michal Hocko cc: Matthew Wilcox , David Miller , Andrew Morton , linux-mm@kvack.org, eric.dumazet@gmail.com, edumazet@google.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 v3] kvmalloc: always use vmalloc if CONFIG_DEBUG_SG In-Reply-To: <20180424125121.GA17484@dhcp22.suse.cz> Message-ID: References: <20180420130852.GC16083@dhcp22.suse.cz> <20180420210200.GH10788@bombadil.infradead.org> <20180421144757.GC14610@bombadil.infradead.org> <20180423151545.GU17484@dhcp22.suse.cz> <20180424125121.GA17484@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.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 24 Apr 2018 15:50:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 24 Apr 2018 15:50:34 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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 Tue, 24 Apr 2018, Michal Hocko wrote: > On Mon 23-04-18 20:06:16, Mikulas Patocka wrote: > [...] > > @@ -404,6 +405,12 @@ void *kvmalloc_node(size_t size, gfp_t f > > */ > > WARN_ON_ONCE((flags & GFP_KERNEL) != GFP_KERNEL); > > > > +#ifdef CONFIG_DEBUG_SG > > + /* Catch bugs when the caller uses DMA API on the result of kvmalloc. */ > > + if (!(prandom_u32_max(2) & 1)) > > + goto do_vmalloc; > > +#endif > > I really do not think there is anything DEBUG_SG specific here. Why you > simply do not follow should_failslab path or even reuse the function? CONFIG_DEBUG_SG is enabled by default in RHEL and Fedora debug kernel (if you don't like CONFIG_DEBUG_SG, pick any other option that is enabled there). Fail-injection framework is if off by default and it must be explicitly enabled and configured by the user - and most users won't enable it. Mikulas > > + > > /* > > * We want to attempt a large physically contiguous block first because > > * it is less likely to fragment multiple larger blocks and therefore > > @@ -427,6 +434,9 @@ void *kvmalloc_node(size_t size, gfp_t f > > if (ret || size <= PAGE_SIZE) > > return ret; > > > > +#ifdef CONFIG_DEBUG_SG > > +do_vmalloc: > > +#endif > > return __vmalloc_node_flags_caller(size, node, flags, > > __builtin_return_address(0)); > > } > > -- > Michal Hocko > SUSE Labs >