Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1229911ybx; Thu, 7 Nov 2019 09:05:13 -0800 (PST) X-Google-Smtp-Source: APXvYqx7f+mn/eb+/2Qj62MVmkTuv53hZBtvz2qt2l3eyJtLAVgVNVZTv+QNMzRDuRPRodTG3Xpe X-Received: by 2002:a17:906:5015:: with SMTP id s21mr3951227ejj.226.1573146313710; Thu, 07 Nov 2019 09:05:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573146313; cv=none; d=google.com; s=arc-20160816; b=x6MidWtgWlETDPYQ2U8ycO5ZrUiFOAmgMG/HY8SlpH8KMku92VCPcqBk4p1mwRamlB 5gDim20pLMoDNPeKC9AiXdo9jbESN8a1Yw/0uesmhnPVLvKf8c30Z5phcRoeK3Ci/dGP kg7Z8fpDHqXO9qPcQM7G51HGvvd/mWTSfCifIIZ7/s+19TMf7YBz2D+p9gWW3aQdqDcL yAwYUtU81qKbnqFljpNzV8Rm/dFGjFgEpvjxRD1ujRdHCaqi96xzeZ8q5szY/X0THQS4 StzwgKsKIo4+oKI7k4Msc33BeWme1esuBiVgza7+OFP7HpJh+12IjTFGdD3J3llDxevq nFnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6o7pF8QsYpCE3iktbsOBRbTc65KDI9iE8fMoadA76CQ=; b=mivtXHiX6vssDL0ANKUy93vE2Yr6tu2egF0NIdP16LdVmaFKMr+Cs12nAAy93JXFNK FSv3/HuoV1zvNAbY0j9LnyXRST7+6uoteW6mNL355PFkiIfov9Csjepghd1Nb1l+ttfx CxndHcZEMqekSjVrLNBhX87k9+0mj/j8HYq61Qi8f92ryQcsK7xLw86efwegGtHRrbHO 27LrkqEfzXlza3nk5Fz9YInZfWzAfv4b6j4B3pYwnTaTg/cj1bmdwohGbie4Q9RITGgK e06O738bwARQCvkbUop51v80vzFPV04tG/NRJyKI5Q7g08GPBNDgipdiR1B7BVmpVvKa 7SbQ== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o14si1914992ejx.248.2019.11.07.09.04.50; Thu, 07 Nov 2019 09:05:13 -0800 (PST) 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730537AbfKGRCD (ORCPT + 99 others); Thu, 7 Nov 2019 12:02:03 -0500 Received: from mx2.suse.de ([195.135.220.15]:47682 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726231AbfKGRCD (ORCPT ); Thu, 7 Nov 2019 12:02:03 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 92CBAAB9D; Thu, 7 Nov 2019 17:02:01 +0000 (UTC) Date: Thu, 7 Nov 2019 18:02:00 +0100 From: Michal Hocko To: Roman Gushchin Cc: "linux-mm@kvack.org" , Andrew Morton , Johannes Weiner , "linux-kernel@vger.kernel.org" , Kernel Team , "stable@vger.kernel.org" , Tejun Heo Subject: Re: [PATCH 1/2] mm: memcg: switch to css_tryget() in get_mem_cgroup_from_mm() Message-ID: <20191107170200.GX8314@dhcp22.suse.cz> References: <20191106225131.3543616-1-guro@fb.com> <20191107122125.GS8314@dhcp22.suse.cz> <20191107164236.GB2919@castle.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191107164236.GB2919@castle.dhcp.thefacebook.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 07-11-19 16:42:41, Roman Gushchin wrote: > On Thu, Nov 07, 2019 at 01:21:25PM +0100, Michal Hocko wrote: > > On Wed 06-11-19 14:51:30, Roman Gushchin wrote: > > > We've encountered a rcu stall in get_mem_cgroup_from_mm(): > > > > > > rcu: INFO: rcu_sched self-detected stall on CPU > > > rcu: 33-....: (21000 ticks this GP) idle=6c6/1/0x4000000000000002 softirq=35441/35441 fqs=5017 > > > (t=21031 jiffies g=324821 q=95837) NMI backtrace for cpu 33 > > > <...> > > > RIP: 0010:get_mem_cgroup_from_mm+0x2f/0x90 > > > <...> > > > __memcg_kmem_charge+0x55/0x140 > > > __alloc_pages_nodemask+0x267/0x320 > > > pipe_write+0x1ad/0x400 > > > new_sync_write+0x127/0x1c0 > > > __kernel_write+0x4f/0xf0 > > > dump_emit+0x91/0xc0 > > > writenote+0xa0/0xc0 > > > elf_core_dump+0x11af/0x1430 > > > do_coredump+0xc65/0xee0 > > > ? unix_stream_sendmsg+0x37d/0x3b0 > > > get_signal+0x132/0x7c0 > > > do_signal+0x36/0x640 > > > ? recalc_sigpending+0x17/0x50 > > > exit_to_usermode_loop+0x61/0xd0 > > > do_syscall_64+0xd4/0x100 > > > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > > > > > The problem is caused by an exiting task which is associated with > > > an offline memcg. > > > > Hmm, how can we have a task in an offline memcg? I thought that any > > existing task will prevent cgroup removal from proceeding. Is this some > > sort of race where the task managed to disassociate from the cgroup > > while there is still a binding to a memcg existing? What am I missing? > > It's an exiting task with the PF_EXITING flag set and it's in their late stages > of life. This is a signal delivery path AFAIU (get_signal) and the coredumping happens before do_exit. My understanding is that that unlinking happens from cgroup_exit. So either I am misreading the backtrace or there is some other way to leave cgroups or there is something more going on. JFTR I am not really disputing the patch but I simply do not understand how the problem really happened. -- Michal Hocko SUSE Labs