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 7606CC61D97 for ; Fri, 24 Nov 2023 09:30:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0BC28D006D; Fri, 24 Nov 2023 04:30:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D949B8D0063; Fri, 24 Nov 2023 04:30:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C359F8D006D; Fri, 24 Nov 2023 04:30:49 -0500 (EST) 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 AEED48D0063 for ; Fri, 24 Nov 2023 04:30:49 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 85115A122D for ; Fri, 24 Nov 2023 09:30:49 +0000 (UTC) X-FDA: 81492328218.04.41078DC Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf22.hostedemail.com (Postfix) with ESMTP id 66196C002A for ; Fri, 24 Nov 2023 09:30:47 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.131 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=1700818247; 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; bh=NFntWWMjiEdn/UTqK8kJkwxbqrPHHhjDdu/JVlrrN+A=; b=CAm2ckXzUPdv7pLs4YJpOLPzroYxSa3n092DqjieqZcvjW9D3oTu5K5ofaEpDdegLQSAo9 vE2IdnFz6a+TQuMKabd8Cq5ni6NcLC3EZNTpmwe29YMV4ner2sQFkgROXhPdlw2itErrSV Ljoh6dWsNxHGSSV5Tv1ejVnqIxFW61s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700818247; a=rsa-sha256; cv=none; b=tjw7SfhI6f6XzhBpY43/SW5cRfaQyZwoqAJd/KlflNsxhCb4/mwXyRWXrWalPBHHaFyZBu hO9hEmINjI98reicZza0AJq23UNZvxbhadSKy167411jXCOlZC8hIh3yVw0xQja36FOvX1 rwcWH0OsidKQhjWKZV0WsV2qji0XRgg= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out2.suse.de (Postfix) with ESMTPS id EF9371FB67; Fri, 24 Nov 2023 09:30:45 +0000 (UTC) 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 C798713A98; Fri, 24 Nov 2023 09:30:45 +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 E3/PLEVtYGXOZgAAD6G6ig (envelope-from ); Fri, 24 Nov 2023 09:30:45 +0000 Date: Fri, 24 Nov 2023 10:30:44 +0100 From: Michal Hocko To: Andrew Morton , gaoxu Cc: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Suren Baghdasaryan , yipengxiang Subject: Re: =?utf-8?B?5Zue5aSNOiBbUEFUQ0hdIG1tLG9v?= =?utf-8?B?bV9yZWFwZXI6?= avoid run queue_oom_reaper if task is not oom Message-ID: References: <400d13bddb524ef6af37cb2220808c75@hihonor.com> <242025e9a8c84f6b96ba3f180ea01be9@hihonor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <242025e9a8c84f6b96ba3f180ea01be9@hihonor.com> X-Rspamd-Queue-Id: 66196C002A X-Rspam-User: X-Stat-Signature: wjistb45xwtuqc9pn4jjwpwtpu4qpr9u X-Rspamd-Server: rspam03 X-HE-Tag: 1700818247-79078 X-HE-Meta: U2FsdGVkX1/r/PrUGCLEb+26/ZUlWrxfaiOeL/CkK6mSqlOOmsAU/O5BxNBSJCRrSa8y9b/gpCKyacQtEECHoFzh1OsFCglvlu1KD33kHoVMh84ZLslc8oBh722cLJR6nQsvYDA5KkF92d8uIXcLkhUVDQwpWEEUBbEnzi8xgpZGt0+bzi60cvMJDBMs352xQPP2yK9nEJJucDI/f3F/xnfq0v8xUbjandJ6yhd0b+ZhAYBD2pI1HFujRMWicTNtYgSnOvHRj6yNWog7e8CkwBn/sO+A/Ao/CgJPtFvqIP7tLEBh0j7ihWZ2PsMCjgw73R1ZjkR8x0okxjCDjB5ccaPNRDGv8c9mDgMCSQULmAs+g7jvAQk7NkJIR3q16460KNxjA0A+P0690E5HcEc8Z2JbuEgRSV4blOn4NESJjxnhdKiqgjrVCypcEVdFucaxOVwBhliaWctHRt7b2nvj0q4aYl4+C83bpCIUFKFqJhzDTx0S8m8//aWm7RuQy6w+cS2DotuxSNLydVlrF1oD3kxI8uIXYwk/vJQXqsR2UQyIHbu1LSqSz9ppBmSm7767AkHTFIVlL9Pds7pNY35Za0xBzmE8r7N7ffh6Kxr7PlwkWSw4IAawb+eqHC0edtjefXBcH7CQf8moTy3OUEi5GUTpvZ53pImqsKXbro9+EWZuHY6iUEakuLWQimcGCiSMDj6TvxCy7E4SiCzZ/MoOo80ZTiQegL8pPoDU3bgFQO7XUW6JJ8NHaPF6HL6utC8qnAp3rrACKWa0frGBbC9h5yLz6potHB4hB20P28igeb52G3iKnPe9kuP11vGzbIf0vcIH1oD07Njnxmh6AqSTB9qIo3DD1K/AR6Kg1yQKIXTS/90FKz6+AA+6dqyMjrtcpGCDeqgA8q1TVBJFYHslJnXWVJlUMUXZ9x73Bq3bldFXM4U+/LrkvpoI84U39Wq0BBzxZ38tWNaP5swS96v 6L+/XRnp /efMVDf+izSe2OBVijSB/Fy8VO+Vmvr6OYXU54GbdLp0YRPEuglJHtZtDCKbp4qORMJtl4BIChu57N2C36wksx19fW5Q/UJzoqMLlX0DHbhsi+648VTvBdh0AvIU5B905NZLApaNrUQpke9ZZrL0Y+hXMenOL705bngBix9IkMGEQ5/FPgE10SLTNutTdK+6uXNxb/27IvjFAMmSZq8hsrbnuvO92JKPla6t1W/x0mtgMA86Qd+XxK1uDfYtfvYZ9430s 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 Fri 24-11-23 03:15:46, gaoxu wrote: [...] > >> [3701:11_see]Unable to handle kernel NULL pointer dereference at > >> virtual address 0000000000000328 [3701:11_see]user pgtable: 4k pages, > >> 39-bit VAs, pgdp=00000000821de000 [3701:11_see][0000000000000328] > >> pgd=0000000000000000, > >> p4d=0000000000000000,pud=0000000000000000 > >> [3701:11_see]tracing off > >> [3701:11_see]Internal error: Oops: 96000005 [#1] PREEMPT SMP > >> [3701:11_see]Call trace: > >> [3701:11_see] queue_oom_reaper+0x30/0x170 > > > > Could you resolve this offset into the code line please? > Due to the additional code we added for log purposes, the line numbers may not correspond to the original Linux code. > > static void queue_oom_reaper(struct task_struct *tsk) > { > /* mm is already queued? */ > if (test_and_set_bit(MMF_OOM_REAP_QUEUED, &tsk->signal->oom_mm->flags)) //a null pointer exception occurred > return; Did you manage to narrow it down to which of the dereference this corresponds to? Is it tsk->signal == NULL or signal->oom_mm == NULL. The faulting address doesn't match neither with my configs. [...] > >> --- a/mm/oom_kill.c > >> +++ b/mm/oom_kill.c > >> @@ -984,7 +984,7 @@ static void __oom_kill_process(struct task_struct *victim, const char *message) > >> } > >> rcu_read_unlock(); > >> > >> - if (can_oom_reap) > >> + if (can_oom_reap && tsk_is_oom_victim(victim)) > >> queue_oom_reaper(victim); > > > > I do not understand. We always do send SIGKILL and call mark_oom_victim(victim); on victim task when reaching out here. How can tsk_is_oom_victim can ever be false? > This is a low-probability issue, as it only occurred once during the monkey testing. > I haven't been able to find the root cause either. OK, was there any non-standard code running during this test? In any case I do not see how this patch could be correct. If, for some reason we managed to release the signal structure or something else then we need to understand whether this is a locking or reference counting issue. I do not really see how this would be possible. But this check right here doesn't really make sense. Andrew please drop the patch from your tree. -- Michal Hocko SUSE Labs