From patchwork Tue Feb 22 00:58:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Randy Dunlap X-Patchwork-Id: 12754387 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 51790C433F5 for ; Tue, 22 Feb 2022 00:58:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81D408D0002; Mon, 21 Feb 2022 19:58:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CBCD8D0001; Mon, 21 Feb 2022 19:58:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 693D38D0002; Mon, 21 Feb 2022 19:58:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 59AC08D0001 for ; Mon, 21 Feb 2022 19:58:20 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 132A512044E for ; Tue, 22 Feb 2022 00:58:20 +0000 (UTC) X-FDA: 79168604760.10.64C3635 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf30.hostedemail.com (Postfix) with ESMTP id C57EA80004 for ; Tue, 22 Feb 2022 00:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=8esseIxDpLtfYeuDOxlgY2S2IYHgIucCVCH5cskkgTA=; b=e8GRw2szGsP7BHFrxqnu8hgp0U eHuIFbnwm1NqL4cQmzR+z+YyWME7r9ni5PhqX4+kq/MgbvpdBh0J9Pr3pid8yVd+scwjJ6lr2hjwL p+QL4WRESqpCExgkZXPYDElcbTO6C6FDDfhTJWyWdV0SWmaafdf/MkVakntciclj0fCS+XhjoL8kH 3FezNFiDO7YqM6Z6zUcPUGaWGlJjxWM0t8QhwAyaId0XSJtsVb5t1qyapLViB/xfcZZBOvUotY9ng eBaEb3sWRU+5ofLBZiibMbLNXfUm4GwfDSqyT340kY/GJUXO/e4zAxJylnpXZ7hWW36NgRMTGTLGw BuIG9AEA==; Received: from [2601:1c0:6280:3f0::aa0b] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMJVM-007Ybe-IH; Tue, 22 Feb 2022 00:58:12 +0000 From: Randy Dunlap To: linux-mm@kvack.org Cc: Randy Dunlap , Igor Zhbanov , Andrew Morton , Johannes Weiner , Michal Hocko , Vladimir Davydov , cgroups@vger.kernel.org Subject: [PATCH 1/2] mm/memcontrol: return 1 from cgroup.memory __setup() handler Date: Mon, 21 Feb 2022 16:58:11 -0800 Message-Id: <20220222005811.10672-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Stat-Signature: 6a3nx75gsg16xqbde1bzcn1x8byd1jrm X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=e8GRw2sz; spf=none (imf30.hostedemail.com: domain of rdunlap@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=rdunlap@infradead.org; dmarc=none X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: C57EA80004 X-HE-Tag: 1645491497-187727 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: __setup() handlers should return 1 if the command line option is handled and 0 if not (or maybe never return 0; it just pollutes init's environment). The only reason that this particular __setup handler does not pollute init's environment is that the setup string contains a '.', as in "cgroup.memory". This causes init/main.c::unknown_boottoption() to consider it to be an "Unused module parameter" and ignore it. (This is for parsing of loadable module parameters any time after kernel init.) Otherwise the string "cgroup.memory=whatever" would be added to init's environment strings. Instead of relying on this '.' quirk, just return 1 to indicate that the boot option has been handled. Note that there is no warning message if someone enters: cgroup.memory=anything_invalid Fixes: f7e1cb6ec51b0 ("mm: memcontrol: account socket memory in unified hierarchy memory controller") Signed-off-by: Randy Dunlap Reported-by: Igor Zhbanov Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Cc: Andrew Morton Cc: Johannes Weiner Cc: Michal Hocko Cc: Vladimir Davydov Cc: cgroups@vger.kernel.org Reviewed-by: Michal Koutný --- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- linux-next-20220217.orig/mm/memcontrol.c +++ linux-next-20220217/mm/memcontrol.c @@ -7044,7 +7044,7 @@ static int __init cgroup_memory(char *s) if (!strcmp(token, "nokmem")) cgroup_memory_nokmem = true; } - return 0; + return 1; } __setup("cgroup.memory=", cgroup_memory);