From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6DC5C27C53 for ; Wed, 19 Jun 2024 08:48:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 616586B034D; Wed, 19 Jun 2024 04:48:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C6066B034E; Wed, 19 Jun 2024 04:48:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48D876B034F; Wed, 19 Jun 2024 04:48:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2B9AE6B034D for ; Wed, 19 Jun 2024 04:48:12 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CDB4A80291 for ; Wed, 19 Jun 2024 08:48:11 +0000 (UTC) X-FDA: 82247011182.21.799E6C0 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf12.hostedemail.com (Postfix) with ESMTP id 874CF40008 for ; Wed, 19 Jun 2024 08:48:09 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=GgvE4mn6; dkim=pass header.d=suse.com header.s=susede1 header.b=GgvE4mn6; spf=pass (imf12.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.130 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718786885; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=35Rmt2W3E0m9QYiuNRzG4CufrPMKZEJTxI/tQbplZeA=; b=SHdsXZfngO15J3r21kxysfdnNlhUAx9i/brwdbdkxO8CNlZXl8kdvU73Xy69qH1mAGzjDF fS01/Q2Q22v0d1niE+GzW/urgKM3bYDDP7IdSkgB92SBW3D2lL0GWKqufx0ngn0wNs2USp eS9EQlknEje0BfhUombM9/rBQAYxixY= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=GgvE4mn6; dkim=pass header.d=suse.com header.s=susede1 header.b=GgvE4mn6; spf=pass (imf12.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.130 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718786885; a=rsa-sha256; cv=none; b=1/+Gcp/Rh21p546rlVaddz6/pDEsoY20VILHvzx6+gtaUe6HIGhMfCl+B3UYQOmHAsz2Gx Z9uTsIWC5I7thLsf75tOp+Hi7cig8mDw7z/CDlb3hOvSV9HjtR7O0bDH5kQoy3qbdNERfR IlCWSBDeKsYWolfQOV02BXQ4+mGnAK4= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id CC79E21A78; Wed, 19 Jun 2024 08:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1718786887; h=from:from:reply-to: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=35Rmt2W3E0m9QYiuNRzG4CufrPMKZEJTxI/tQbplZeA=; b=GgvE4mn6TiMzElr5XgZbpcKYEx6S7VZKdnpmBUHUEzuHcM9cCn3V5jKBXLEPOKnCZl7KjF HJkzs+wdIciy/wRCB11N8rWWQsK7uXsbPcADfi6dDz8tN2w3pzWKI3UBtByNdANt9Q4k6L sgOoYblw7cqDNaB2ENy6Gc2sU8XzN3A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1718786887; h=from:from:reply-to: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=35Rmt2W3E0m9QYiuNRzG4CufrPMKZEJTxI/tQbplZeA=; b=GgvE4mn6TiMzElr5XgZbpcKYEx6S7VZKdnpmBUHUEzuHcM9cCn3V5jKBXLEPOKnCZl7KjF HJkzs+wdIciy/wRCB11N8rWWQsK7uXsbPcADfi6dDz8tN2w3pzWKI3UBtByNdANt9Q4k6L sgOoYblw7cqDNaB2ENy6Gc2sU8XzN3A= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B2A3E13AAA; Wed, 19 Jun 2024 08:48:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id TvsFKEebcmZYIwAAD6G6ig (envelope-from ); Wed, 19 Jun 2024 08:48:07 +0000 Date: Wed, 19 Jun 2024 10:48:07 +0200 From: Michal Hocko To: Shakeel Butt Cc: Andrew Morton , Linus Torvalds , kernel-team@meta.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kyle McMartin Subject: Re: [PATCH] mm: ratelimit oversized kvmalloc warnings instead of once Message-ID: References: <20240618213421.282381-1-shakeel.butt@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 874CF40008 X-Stat-Signature: oakj959cin75zusneai9i3qi84dosn3h X-Rspam-User: X-HE-Tag: 1718786889-24100 X-HE-Meta: U2FsdGVkX18m+CnH8UkexmogpO4iSOgOo3GouZatFa8eOLzpfNp0T7PdiVLh9W2Y4Wekn1+5vg68t3HMaq/DFCPCdKi6HazJJ7CkNGLEoR5Qyrhf77DdZDn1/bgwri1WV9ghBddk7HBVjSeIsM92n9gc7TsT5LljGsBGKeXB9nIv+zVz0OoGyVZTRTmhVUZg9h4R5kalluYGNo4UxhiEulctYPaULLgu2VgfKB/QJOOaqLWQ7fKlm5DG2V9zuJHop7TR3JCDorXHczCWQBprNZFk1QeDP1zeep9eIonUma+LZTLcTQJwZptw3mg8AYkLdCfMNk/Oc+kRXYSFGsRCUri6zQ1wIOxnxpapZ0xKkuVy21C9JCi0p4xS/9c5tAMvLlZW2W51s6P9rxnjZ8IexaGTMzPNCEXVDsiv+d0ESSIncNJj8KVTJdoaQkM9vWQB6W7EdnXyR2bTeeqMOnAyVmRyK9rVi0MdzwQjJqgtEPajP0XehhpQoHycuMV8tNfLapxNlbfXUgB+umI4TaqwWh7Mf0+8VVBmUNIfrRrU7GshaJPFLnzqqJLLFhBht5qcBri+1EwuAuhTTW9fkoKjObWofIc04I5U7cwoddspqHCV8b1KiqE5jXhyOJKgbngxeNMMrlZ/Q+XlRCpsWtp43rFho7My2ZRmlEQje3QNKPz9vSuxmhPZHPLDC2X3Y0FWWURoG6la3p48/nSMW2u09TMO8v10TiTKo1/jHhr7jxr+F2Gh/eZhNg62palLYHr1sFjPRGskcvHcHCni74FHOk5KhZ+jJV9XgWkW0Wyo8kUlqK/+DE52eF65OdOaEhiFUFq0Mjyp7Xl/f1/w40VP7UKFe+pdyfRf5rOCeniznP+z22Orq1rAa4WD9+XTmb83sQrFrTY8WE+DST6F70SdSJigE/RESxVzTS+Tg3PTh7O63jEmJcAsW5LquJP8+J6yV4d0Y3RX03wkqkRgYPE EWTZFQrm yLFcg+HzwpyKPLtZ4Lkms4UyKaD2XJ5Ue0Ag0AHDF3ETtc4NzunEpnKXEd8owvWPzkYq6E6v5gSPFFevpWy03usbw2SlPI7ktZ0q9DcL/tqbNUw84OObclAfSYscBhdFw3aSTTonuZdwRH/sytJ1YFFsDwWUT4YYVRQDXHkuae4NqM7Ab2mUmNV45N4OWfRfQWd/snnhfgahWo3DiNt8kqchOHdMM8faDJ24tRMJWuBvRkOZiraLnAX1lBQt+yU2WGlLTyx6HCQ4NWCccgHAdhNrT7LHgVxNaYWtSQMJdpyx9Iq+fDsujaNn9sQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed 19-06-24 10:30:46, Michal Hocko wrote: > On Wed 19-06-24 01:03:16, Shakeel Butt wrote: > > On Wed, Jun 19, 2024 at 09:19:41AM GMT, Michal Hocko wrote: > > > On Tue 18-06-24 14:34:21, Shakeel Butt wrote: > > > > At the moment oversize kvmalloc warnings are triggered once using > > > > WARN_ON_ONCE() macro. One issue with this approach is that it only > > > > detects the first abuser and then ignores the remaining abusers which > > > > complicates detecting all such abusers in a timely manner. The situation > > > > becomes worse when the repro has low probability and requires production > > > > traffic and thus require large set of machines to find such abusers. In > > > > Mera production, this warn once is slowing down the detection of these > > > > abusers. Simply replace WARN_ON_ONCE with WARN_RATELIMIT. > > > > > > Long time ago, I've had a patch to do the once_per_callsite WARN. I > > > cannot find reference at the moment but it used stack depot to note > > > stacks that have already triggered. Back then there was no reponse on > > > the ML. Should I try to dig deep and recover it from my archives? I > > > think this is exactly kind of usecase where it would fit. > > > > > > > Do you mean something like warn once per unique call stack? > > Exactly! > > > If yes then > > I think that is better than the simple ratelimiting version as > > ratelimiting one may still miss some abusers and also may keep warning > > about the same abuser. Please do share your patch. > > https://lore.kernel.org/all/20170103134424.28123-1-mhocko@kernel.org/ Btw. the code has changed a lot since 2017 when this was posted so it will likely need a lot of massaging to rebase. Also I am not entirely sure it is ok to change WARN_ONCE semantic like that anymore. Maybe we need an explicit variant that does this per-call-site warnings. It is a notable difference between library functions which can be called from different callpaths and those that are used from a single place. I do not have much time to dig deeper into this but if you want to take over then go ahead. I still think this is a useful WARN_ONCE or in general do_something_once semantic. -- Michal Hocko SUSE Labs