Message ID | e1036b9cc8928be9a7dec150ab3a0317bd7180cf.1720572937.git.wqu@suse.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 EBDFBC3DA41 for <linux-mm@archiver.kernel.org>; Wed, 10 Jul 2024 01:08:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6140D6B0085; Tue, 9 Jul 2024 21:08:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 59D076B0092; Tue, 9 Jul 2024 21:08:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 465156B0095; Tue, 9 Jul 2024 21:08:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 299C36B0085 for <linux-mm@kvack.org>; Tue, 9 Jul 2024 21:08:21 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D436D141593 for <linux-mm@kvack.org>; Wed, 10 Jul 2024 01:08:20 +0000 (UTC) X-FDA: 82322057160.03.B060F4E Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf26.hostedemail.com (Postfix) with ESMTP id C2418140013 for <linux-mm@kvack.org>; Wed, 10 Jul 2024 01:08:18 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=VcmbvJu3; dkim=pass header.d=suse.com header.s=susede1 header.b=VcmbvJu3; spf=pass (imf26.hostedemail.com: domain of wqu@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=wqu@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=1720573683; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0x37no3oT/qmyGyMegZBwccgMqLWt0TBXMu5cGm2nAY=; b=zabSZGg+30J9PgRNs8afAK4Rid9atkduHzKEMXmb67r4d75OyMM3Vv+h92jH5tDkkQf26s nS44fOQeztvBQlj888tE4Q+qeVzEX91Zu5oU3rvUNlcucYUELSngYZy4BItrmmh2vwmNuF SBMlag26fsF0JgT7N+xV7t+TVoC6DQo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=VcmbvJu3; dkim=pass header.d=suse.com header.s=susede1 header.b=VcmbvJu3; spf=pass (imf26.hostedemail.com: domain of wqu@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=wqu@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720573683; a=rsa-sha256; cv=none; b=powtPeULg/w1d+zJnLuBzRS85pu0+2OMXjIlTT9Y7XMFv9SXfs+UFouhCCDkwrUnq2kpeS mEG9N9MnMQSBt8NreuJeWigEt+0Ak8ihHqwKINjFNxqCPcSrHwGGLQhRA8KkbOlHi2eTge IGAaI8VQyqX9Ep4+rfZ6yz19yY1fWeU= 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 0958E1F7D1; Wed, 10 Jul 2024 01:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1720573697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0x37no3oT/qmyGyMegZBwccgMqLWt0TBXMu5cGm2nAY=; b=VcmbvJu3ZP1+HjwUPCS9Zaq+dKb3jbJkfFpuaEDcQhLVp5fd+jK3EfNFsalfDOthb1FaYd z8nu6IxiRPckks0huzFMKShKobStOv9M8R3PfX9OUuBh05Fw52xT+DLzEWzyp8QWO4K6j5 Igwzvt4m0CReJY6XfzYUwXpdGwy/kRs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1720573697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0x37no3oT/qmyGyMegZBwccgMqLWt0TBXMu5cGm2nAY=; b=VcmbvJu3ZP1+HjwUPCS9Zaq+dKb3jbJkfFpuaEDcQhLVp5fd+jK3EfNFsalfDOthb1FaYd z8nu6IxiRPckks0huzFMKShKobStOv9M8R3PfX9OUuBh05Fw52xT+DLzEWzyp8QWO4K6j5 Igwzvt4m0CReJY6XfzYUwXpdGwy/kRs= 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 932DF1369A; Wed, 10 Jul 2024 01:08:15 +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 4NQZE//ejWaYTQAAD6G6ig (envelope-from <wqu@suse.com>); Wed, 10 Jul 2024 01:08:15 +0000 From: Qu Wenruo <wqu@suse.com> To: linux-btrfs@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/2] mm: make lru_gen_eviction() to handle folios without memcg info Date: Wed, 10 Jul 2024 10:37:46 +0930 Message-ID: <e1036b9cc8928be9a7dec150ab3a0317bd7180cf.1720572937.git.wqu@suse.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <cover.1720572937.git.wqu@suse.com> References: <cover.1720572937.git.wqu@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Action: no action X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: C2418140013 X-Stat-Signature: mut3mdyb7mmaz3b51j6oxz6d7ih7j6f1 X-HE-Tag: 1720573698-717013 X-HE-Meta: U2FsdGVkX1+9oGtyb6SHYxNihM7TBEEdtWtC8SJqee66gLOlpmbVarfZ0cxbvC4IpqebQm/UHvHU1gp5kL4wNubo1paQj0W85DsXYZPYp5kqvqYQfR05DF2p+I5wc7PtRcOgoHnkLmVFOLRVMxsJE5HRzmHkRF4kzUNsLCY0c+TC9ynMNQF+rmaQT2+CD+6vVEXzvUGfmnBkMOYOJCmoG9rAMwZ8W2pQ2OW70acpwPzP17C8hr1wNLIfFLPxot9mxjA4sZakzZIh6pTpK1+2lldrxs+JDekdyfeAR+YXTRlYY788ZBn8IxTPfmqmt00cwT8HYOcZM7F1RwWG8qrDv5bz9uO4YnEnRV4GVdLBUJ/1SY+GjTImYvgUbrL6GeODBnRPZIf5JTcmsCDHGOxz+DewJKm6bpaabAtPzL/c8JYQz6c+j5kplyMLHtEjmBfSGaH1Yasa2lzInSz8wHJTDu1opXKLmQfyM4Uqn3G+tYciJ+XNzal4U9BrHuCcliLEuYMuhCvc+ru6SliEPATOmR2ppp66d9fAun33IqOfdsSp1VoRTnt0LbvJ5ZJ8gppwUOiKqnlzE8bp/oIxbt0yx0VBpri3GN71lj84Elx2DcHf62WWEZrQiwEZrKlzSatkhAWVOQg9nGZ0LyOFDvDPLABUOV5BXLm+4R0IZHWhBa1xnbNJ/z+I1mW74b1cmF4PLGUeVtpZPqMOHZ7UcFzrH9dBOreYBDMrHXWZu+TQa9KaQXaCYscOINoCc6N8A+GPtAaBgld4G3hGH4fQElqipiyqBT0ZRRHBuGUysyJ93O+D7ivf2kjdj/fhwGjnIeSmhhHyDYXBbcN6fqy3UDDjM9xtVjPX6m9PU8r+vNxkbZbGVPOs2tFC8C/B6y7gpYq1/HPOqdeMuKjPqVwpm/UNU/P+UmG203fxQFYHlgNnHLLv04m9aphUW9p6A8U31iz5Xhk6iaKsc4x61hRQv2h pLoCBKsC wvnMgTgkItd8htTbgcg5GMCNhMutJSfXbbTvmamgcVCFBgNmT5ytdinpmsET3FSB/1GcjkG4SlG8gJ61PTpsgIkldXrl68abcWNgnmfBzK9bCmpPSbhwiVbFLIYmuQF+kvmilC/sGGYsBMjVQ49OfTZN5TPkuKvvilmZfVFWwDn/U97LHBGtrdwDhgdn73nuWNPlGPwsYXuk3X2oKrSsGky1wFQMZHY/l/zAh1jK+rlosqKlWHnbfJQz4Av66NfSfSYeLy45KkN4gynv/PKeCkAeIOsPpQrqPHyzu07zQadDBH+tE0osvX1gsmQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000466, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm: skip memcg for certain address space
|
expand
|
diff --git a/mm/workingset.c b/mm/workingset.c index c22adb93622a..449042d10803 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -253,7 +253,7 @@ static void *lru_gen_eviction(struct folio *folio) hist = lru_hist_from_seq(min_seq); atomic_long_add(delta, &lrugen->evicted[hist][type][tier]); - return pack_shadow(mem_cgroup_id(memcg), pgdat, token, refs); + return pack_shadow(mem_cgroup_id(lruvec_memcg(lruvec)), pgdat, token, refs); } /*
Currently lru_gen_eviction() fully relies on folio_memcg() to grab the memcg. It's fine for now as only file folios can enter workingset_eviction(). But for the incoming change which will skip memcg for certain address space, we will hit folios without an memcg info in the future. In that case, mem_cgroup_id() would lead to NULL pointer dereference. Enhance lru_gen_eviction() to handle such situatioin by calling lruvec_memcg() instead of using folio_memcg() directly. Signed-off-by: Qu Wenruo <wqu@suse.com> --- mm/workingset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)