From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8FC3284A6B for ; Tue, 14 Jan 2025 08:40:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736844039; cv=none; b=WJ5vcJv0RWzkuR9phZOdVdPb4WdzsSYs2HuX9M8hTI/V6+B6tTxbPRSiUlvA5RmhwdNbhBA0Fd4H3817eEgTZV65LX4u/NleP3fAIRGM+z5kEgF1Py3Sm865zchA7Gjg24tAssvK7G8DkdyJEPlcgN1pW8GQ8fOEisTGvcoFOvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736844039; c=relaxed/simple; bh=HDLh4ABY5og73UWWJiQ9ZMxp/+5sJtvgGr2cwpqz74w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SriripZP5Sc6dTZQyceufr8fajeFN90/4DsE/tl/8yYK4NRJ/rvhxSBDQX+FLilPhq5R1tLfBmT9P6VSpBWsIiYLxTR45oL79Xj3pjkLc27nlNCvkCZlmVv0lFOL3d927MMJdTtdOenuJEWMFxCEh0j1cYrU3Mr7b5Z58AITMUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=PSt8AdUb; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="PSt8AdUb" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-43626213fffso37574095e9.1 for ; Tue, 14 Jan 2025 00:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1736844036; x=1737448836; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=arro8hqRUCXkL90V/UNNtQl0Bv9DZZdmFTRHHjOo6Ys=; b=PSt8AdUblbgI6lmNML0cZAZaW5nHD5u1LWoaUYMGtZkanN/li6znBJ7afoXJtn64o+ vA4r1Fdw9s6fWGKL2069Hnb3VjwIfmguzypCcCjSkvGo91IqLYv8RwCLJgK9wZE88pXW nPbSkIb30P4mzvNEG8LsufwTeJ1OhMBj3pxfEDPUt2fYrk/dn5qTTKjamSMeLuPu6zmo xUBSCrfrMQ5J1vet8kpMtvnQy9tceYH7n8SyOssjpVK1YxhUjgQFRDlbx9jMcZT039B7 fs38j2YDP2wjU7mMI8h4r8biaVJhElaOKPKLs6sSjdYfSAc8ZQFR5Q0vjKtoayiV7mfD XyPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736844036; x=1737448836; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=arro8hqRUCXkL90V/UNNtQl0Bv9DZZdmFTRHHjOo6Ys=; b=lLrfMIrwcO8NFHy7LiEbNz4JPzpVE7ar83AoX361sytnlQLMtSG7oCCBhD47mkLZ5h mZp1DxFyEFFb27DhvkWVOy00T3u/RbW8LzYftGDsxvwUR7yvOWYsVq94uHhgr7fC0iKK TD9veBT/EjFKCqTddlUr1Zf2kh9fffnMaK163E+Gs03we5Cf7upLVFlUyuALWGqoRJA6 wqeuT2ITT3jb5bTfndj7qrjVn788YBbQBDCyJ/dbT1sIr58EVqRVc6qTcXTr92WkreOu mC/m+/y3ydvH0nEh7M6wvCkFY3PTDAp4HGWR2wcPKeimfPBks4fLZMymOn2I1jZKWGdE X0mg== X-Forwarded-Encrypted: i=1; AJvYcCW3baVshcw1D54iDK1F1MuMvUidy6wM07zbZVCaXHweVPplFhywXitagPyaNeHCJeZIgT8Ca8eaRtOn2ew=@vger.kernel.org X-Gm-Message-State: AOJu0YyC3P7JhXZ5bHA2dyEJjIUEGzy3zhDHyhLp3KrttIaFZXOwCrEU /pZxmRegyemcwkDfYdXYnwN5hqJsli18A9dsuC38XpOUslcpDWu2pHS1CfoNOQk= X-Gm-Gg: ASbGncvSpmuucGlGkQWXCaemHjBLMYxsAsFvrPA4bX1gFAHcOdENqPMlI0FCydujZL+ fHaRaoZSbP/REbf2oGnvTggr43CB0fJ/GkweW4cuEsPKA6EBBttgFJQAKqHo4w/kHGwPFaGGu0O Du8skhYEfoqvBjDGt3PseuH7XfxymoQLSIBvxk2fJmk5KgSUBDIw4QsTx3qKh2o52/2IaQx/c0B 1STbOK1XsUuBHn6x2ajVJqebtHSloSuCrcSqwTsTDWMtgBS9e4reAlW7oXkq7LthYsdTg== X-Google-Smtp-Source: AGHT+IE1cZ5Uou0ZikaojmMVGumlPj++UeBWrnDMQpxuLsFJ2giWup6lhK4Jzd72u8Y7fFKBkRcd3g== X-Received: by 2002:a05:6000:186e:b0:38a:8d32:272d with SMTP id ffacd0b85a97d-38a8d3229edmr17003016f8f.28.1736844036090; Tue, 14 Jan 2025 00:40:36 -0800 (PST) Received: from localhost (109-81-90-202.rct.o2.cz. [109.81.90.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4b80b2sm14026164f8f.80.2025.01.14.00.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jan 2025 00:40:35 -0800 (PST) Date: Tue, 14 Jan 2025 09:40:34 +0100 From: Michal Hocko To: Andrew Morton Cc: Chen Ridong , Vlastimil Babka , hannes@cmpxchg.org, yosryahmed@google.com, roman.gushchin@linux.dev, shakeel.butt@linux.dev, muchun.song@linux.dev, davidf@vimeo.com, handai.szj@taobao.com, rientjes@google.com, kamezawa.hiroyu@jp.fujitsu.com, RCU , linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, chenridong@huawei.com, wangweiyang2@huawei.com Subject: Re: [PATCH v3] memcg: fix soft lockup in the OOM process Message-ID: References: <20241224025238.3768787-1-chenridong@huaweicloud.com> <1ea309c1-d0f8-4209-b0b0-e69ad4e986ae@suse.cz> <58caaa4f-cf78-4d0f-af31-8a9277b6ebf5@huaweicloud.com> <20250113194546.3de1af46fa7a668111909b63@linux-foundation.org> 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: <20250113194546.3de1af46fa7a668111909b63@linux-foundation.org> On Mon 13-01-25 19:45:46, Andrew Morton wrote: > On Mon, 13 Jan 2025 14:51:55 +0800 Chen Ridong wrote: > > > > > > > On 2025/1/6 16:45, Vlastimil Babka wrote: > > > On 12/24/24 03:52, Chen Ridong wrote: > > >> From: Chen Ridong > > > > > > +CC RCU > > > > > >> A soft lockup issue was found in the product with about 56,000 tasks were > > >> in the OOM cgroup, it was traversing them when the soft lockup was > > >> triggered. > > >> > > > > ... > > > > >> @@ -430,10 +431,15 @@ static void dump_tasks(struct oom_control *oc) > > >> mem_cgroup_scan_tasks(oc->memcg, dump_task, oc); > > >> else { > > >> struct task_struct *p; > > >> + int i = 0; > > >> > > >> rcu_read_lock(); > > >> - for_each_process(p) > > >> + for_each_process(p) { > > >> + /* Avoid potential softlockup warning */ > > >> + if ((++i & 1023) == 0) > > >> + touch_softlockup_watchdog(); > > > > > > This might suppress the soft lockup, but won't a rcu stall still be detected? > > > > Yes, rcu stall was still detected. > > For global OOM, system is likely to struggle, do we have to do some > > works to suppress RCU detete? > > rcu_cpu_stall_reset()? Do we really care about those? The code to iterate over all processes under RCU is there (basically) since ever and yet we do not seem to have many reports of stalls? Chen's situation is specific to memcg OOM and touching the global case was mostly for consistency reasons. -- Michal Hocko SUSE Labs