Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp693971rdh; Wed, 14 Feb 2024 08:40:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUundnwQKxMi/KDwALLNtoGygAQjMsFNpwJZHHTAXoKewO5YLRlj2t0AO4oxgfglDoemkSVp9ziZE11po1G/5sKORzJLHWpNeI2qId7hw== X-Google-Smtp-Source: AGHT+IECIuY326lGQp6I2tIg5HQjw15xlbPgySCZT0deqfPvv359pVKV2F2x8EsUhULFDWy/jVLz X-Received: by 2002:a25:ec12:0:b0:dc2:2f4b:c9d8 with SMTP id j18-20020a25ec12000000b00dc22f4bc9d8mr2840265ybh.16.1707928806491; Wed, 14 Feb 2024 08:40:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707928806; cv=pass; d=google.com; s=arc-20160816; b=QBV7z4O8t95rQBhiF9N1iG/QCkRBsUp4igG47nuP83CTRnU+YnEbXiqaydw53Xg0QZ y1U82rSunpgbFQpWnKD9btMkO55UGBwZKdiS4n7d268sEZgGKh+kE8G1pJi/KAkjmH0W awi6X+h7rRfMdLfhE56VT0pdifZY3pq2bZl+aNTFe31EbNKPgY60tJsZJWdaGQlsbIDH c8wY34v39T07FxzoSJ3CSRmB90bbCAyPQqRMIzzegSYg62EpDlx1KU3BUZKFmr7i7UHb yvSU80ZoEep8uATMy7c5/nN2M+L4Dm50/d9Kf0/8J7rJVXWHBrpc7JI2svtw6QFgo/Tm 9Umw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=GhC8U54i48aAhQsKXgUpTdpqc3Q9oBEWvXQFXanbxaU=; fh=D/Lph3v4aWgl4TxU99X/A50W2ZySS97OwmDGP5b7BYY=; b=uBvf+v9UmT/7HlsF9gVNVrHFRymAeEuIKz8G/oK9lHvj4ru1ZtRXgvEZ5yd43f+XzD ygCp6JRtj3UgjNvHtpzQ6Yx5q8Tj8p56nejKZEJGtf2x1z72eAQSrtY8en6RJPGfVVCE +0P8rVUfabEGd/f3oX2fTt8CJnA+3DOIttFQ6iSrD8siSpQYvcZVhRMkYk5G7MGiMMM9 wVr1HMuo0YUMPCXsmXuk3+fpzo3WX3LHhaUj5zzGlZlTy8bOPIySS0WBk/sf74lwhlpt gLZcuSr4K86A73mU6IJYsISRvlWeSI5Hrk4J8MBfzG0+1P6Ac8aC3pEVfyd03eQJsXqo lRtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Xm+zNKCM; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65564-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCUL7KVORJKAUQN2dcV+QuAqi3Mx2axMdiPcbOnoFrlRWqrKUst1lQ40cXVFmcrWCxm/S1tsYO1sivtBvrzySMPqYzYKhRKafY76XpZkdw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ee26-20020a05620a801a00b00783f57b3584si3653228qkb.239.2024.02.14.08.40.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 08:40:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Xm+zNKCM; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65564-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3E8F51C278E0 for ; Wed, 14 Feb 2024 16:40:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A837C61671; Wed, 14 Feb 2024 16:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Xm+zNKCM" Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 961BD22071 for ; Wed, 14 Feb 2024 16:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707928709; cv=none; b=F79yZVB/6fPKblQJpoWC8OzzWMbTmtYa5Tbf5QZYZ9xsbdVVZy7y6+xqGJDuytk7R0Bp3rqlTncPpzHhXj80iQL1ZWTpiXO1p0MJAM6WVOq9+n1jjKKuTfSscoL2f4KJEtBJIb2mbqz3g+w8VBKoaLcmziBY53d9iy0+JSfXJ4Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707928709; c=relaxed/simple; bh=3a96hFHa9kHGgs4R7+BbKUdcoCcJIe8Xk80EXRVjjJA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=r8UHyv3dGcse2eiB12Quz8movSFkYtBA0hopqYL6HgImmmKJGpjkl86QNa5agkjuj8iGGlzwxASuQW9u6EN5QKA2Trt9HdcTQbyNrOAMx/QP0qFT9CkjrzYTOLQruQ8VXhAuVC5q9zSgvTeZMgyETVnX7F+hQxFx+3LAV3HZ09g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Xm+zNKCM; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Wed, 14 Feb 2024 11:38:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707928705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GhC8U54i48aAhQsKXgUpTdpqc3Q9oBEWvXQFXanbxaU=; b=Xm+zNKCMeqV79v7rJ5E5an4MzgIP4PD8/8ugFWMqKQm3NKxkYrYq0OYQxclkHYIL8RZCoP TC2LBaoxPghcPUQzNf8N/tkj2r5IU55ThbSV14NQ/Bs/1muwGdvLMDBwjC0Nd8EVp21WU+ XnEe90fkimXt0ALl4VLMlcoyT6d4gss= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Vlastimil Babka Cc: Suren Baghdasaryan , David Hildenbrand , Michal Hocko , akpm@linux-foundation.org, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Subject: Re: [PATCH v3 00/35] Memory allocation profiling Message-ID: References: <9e14adec-2842-458d-8a58-af6a2d18d823@redhat.com> <2hphuyx2dnqsj3hnzyifp5yqn2hpgfjuhfu635dzgofr5mst27@4a5dixtcuxyi> <6a0f5d8b-9c67-43f6-b25e-2240171265be@redhat.com> <4bb7b1e4-d107-4708-bb65-ac44d4af9959@suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4bb7b1e4-d107-4708-bb65-ac44d4af9959@suse.cz> X-Migadu-Flow: FLOW_OUT On Wed, Feb 14, 2024 at 11:20:26AM +0100, Vlastimil Babka wrote: > On 2/14/24 00:08, Kent Overstreet wrote: > > And, as I keep saying: that alloc_hooks() macro will also get us _per > > callsite fault injection points_, and we really need that because - if > > you guys have been paying attention to other threads - whenever moving > > more stuff to PF_MEMALLOC_* flags comes up (including adding > > PF_MEMALLOC_NORECLAIM), the issue of small allocations not failing and > > not being testable keeps coming up. > > How exactly do you envision the fault injection to help here? The proposals > are about scoping via a process flag, and the process may then call just > about anything under that scope. So if our tool is per callsite fault > injection points, how do we know which callsites to enable to focus the > fault injection on the particular scope? So the question with fault injection is - how do we integrate it into our existing tests? We need fault injection that we can integrate into our existing tests because that's the only way to get the code coverage we need - writing new tests that cover all the error paths isn't going to happen, and wouldn't work as well anyways. But the trouble with injecting memory allocation failures is that they'll result in errors bubbling up to userspace, and in unpredictable ways. We _definitely_ cannot enable random memory allocation faults for the entire kernel at runttme - or rather we _could_, and that would actually be great to do as a side project; but that's not something we can do in our existing automated tests because the results will be completely unpredictable. If we did that the goal would be to just make sure the kernel doesn't explode - but what we actually want is for our automated pass/fail tests to still pass; we need to constrain what will fail. So we need at a minumum to be able to only enable memory allocation failures for the code we're interested in testing (file/module) - enabling memory allocation failures in some other random subsystem we're not developing or looking at isn't what we want. Beyond that, it's very much subsystem dependent. For bcachefs, my main strategy has been to flip on random (1%) memory allocation failures after the filesystem has mounted. During startup, we do a ton of allocations (I cover those with separate tests), but after startup we should be able to run normally in the precence of allocation failures without ever returning an error to userspace - so that's what I'm trying to test.