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 02E2AC3DA6E for ; Wed, 3 Jan 2024 09:03:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 878A28D004B; Wed, 3 Jan 2024 04:03:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 82A4D8D0035; Wed, 3 Jan 2024 04:03:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B5BA8D004B; Wed, 3 Jan 2024 04:03:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 411188D0035 for ; Wed, 3 Jan 2024 04:03:15 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1682AA14AF for ; Wed, 3 Jan 2024 09:03:15 +0000 (UTC) X-FDA: 81637410750.27.79FB139 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf10.hostedemail.com (Postfix) with ESMTP id CBD9BC0027 for ; Wed, 3 Jan 2024 09:03:12 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=jepADU8i; dkim=pass header.d=suse.com header.s=susede1 header.b=jepADU8i; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf10.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.130 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704272593; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=F/wKVvKvm03UEJ1zWEiwuyaYFJhvNJ616HPYPBiI8YQ=; b=BcPr4379WBzTxFcMoGs2ZXF+qqVvunopsPE9tZ7g8xVQmwvLeOxfVTOpVREyww0Vsj/Xmr r8xUxZg7rvX8W0Bvkir4mn4qAgD+2jZkQ5Ca2RBIdYbauNioU9S7qjrfoEpFJCezTw00mR Vycvta6V5ErfeQ+HvkDd8YF0eV7iBdA= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=jepADU8i; dkim=pass header.d=suse.com header.s=susede1 header.b=jepADU8i; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf10.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.130 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704272593; a=rsa-sha256; cv=none; b=kvE3pCGolL1Bg9zFYDUIjMttHYehZSO03/J+YQxFGLR+5UQ5/XsiUp3CbhRi2LyBgmEwKw ALJYkV6vOxoU22RDGgDAAB73S8wJ4O8gNz1fXURGpwoPhFdOWEb/JfzLkrXXCdnS2IHIUr qDts7fYoUaCkcI7cdrxKy9XePXbs8Vo= 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-out1.suse.de (Postfix) with ESMTPS id F3EE421C97; Wed, 3 Jan 2024 09:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1704272591; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F/wKVvKvm03UEJ1zWEiwuyaYFJhvNJ616HPYPBiI8YQ=; b=jepADU8iST6CjLUnRT9a6jAE+w0C5dLforvavtktIEjjD64Ml4ZI4pCqMYDuKtn059CLu/ Aedew8aMfA4gaK07k1/8MawmuKIgqdLHrH3lX13QA2CXzb+WmxachkHtNme4ki0vHMzTUN XMjwx89DRMm9i3PPVglC7tHwiw/0sjE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1704272591; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F/wKVvKvm03UEJ1zWEiwuyaYFJhvNJ616HPYPBiI8YQ=; b=jepADU8iST6CjLUnRT9a6jAE+w0C5dLforvavtktIEjjD64Ml4ZI4pCqMYDuKtn059CLu/ Aedew8aMfA4gaK07k1/8MawmuKIgqdLHrH3lX13QA2CXzb+WmxachkHtNme4ki0vHMzTUN XMjwx89DRMm9i3PPVglC7tHwiw/0sjE= 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 D4B841340C; Wed, 3 Jan 2024 09:03:10 +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 CJ0gMs4ilWUcaAAAD6G6ig (envelope-from ); Wed, 03 Jan 2024 09:03:10 +0000 Date: Wed, 3 Jan 2024 10:03:10 +0100 From: Michal Hocko To: Dan Schatzberg Cc: Yu Zhao , Johannes Weiner , Roman Gushchin , Yosry Ahmed , Huan Yang , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Tejun Heo , Zefan Li , Jonathan Corbet , Shakeel Butt , Muchun Song , Andrew Morton , Kefeng Wang , SeongJae Park , "Vishal Moola (Oracle)" , Nhat Pham , Yue Zhao Subject: Re: [PATCH v5 2/2] mm: add swapiness= arg to memory.reclaim Message-ID: References: <20231220152653.3273778-1-schatzberg.dan@gmail.com> <20231220152653.3273778-3-schatzberg.dan@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: CBD9BC0027 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: n9ap18yjiroxm1rde81n45q3kss6rnzs X-HE-Tag: 1704272592-998744 X-HE-Meta: U2FsdGVkX1/rg1zC8dfaRj1FWVI+vd5ZoQCR5drBbWq+v9ntcyozOQuQadn/TCuhBEEsvRBCeHGMhHIuZE9xDhnUeDV5xzparyL7DHCEbs3jKmRRAcFFe0DadZFkI38MD3kA+i0VqIkrFT5bb2zT8gtalSI2dVmbHSg64+G1vC7Wqag+/VLmGmKvxV7M/hKP0Z1qOGskpE4hym504yxWNcQZedkKA7Fy45rX/TtlYhsEF4wyZEgiQUAszONhOxEZZE1PXVSimR24rWObDTCHML3STSweK/7WXAPBkWil8UqEZL4KUw00qT1yvQaYKBH1wveRl6lR8UB6rYklK00VdpXIc47DpuIE/J7ZcUF3JCZ6J/bb5RmxGp83/WyawY2lzkT0t+320yBo1QqwmULiz2vVY3Gd97eyLTtTWoD27ExlVeiSWS+Iv1FC1I4imIVhdMCQzNvNbTHlTZhYXyhfpTIK10a+kuUCdjUE37wQP9Dg/oXGG3jQSykE5XDfqoD0N5ReJP71EIGgp5/yL9fmK2Kj/1H9ND8s7XT53oSayahEUSjCALrpuAktuSbMraQ2FHh4c6MbI6mZyWrpFGq3xiuAtQcTEawcGXYCK1Atm9TCDSUy0w343JiKqy0haOuH4aT64WkE+ig66mZD75eDqZH6628CPFkbZ2J5Egt69PHwWxA07B2AdjTxjxWlmU8VK8Zis22hdD/PBYwRM0g2uz1k1Ytvhz4vMCY8xQb9loOK/dsbgtId3MQckih0I6IYWYwbY+/g10X+vkzlU8fEKZEcZhDzLky19z3vBar5zXomvWrBWCyDA+GN7hPFk+vcnmEHG9L5lzRKfLt2rDqlQhgrX2iGxFRbezjHS3q4uehscu2MpEvgnY9x51o8Dra2cGvM4AsYEK5ty/D1M6/TeA6cXO++YVk70+37wTC4d/RvRr0s7qATICyK+eVtiIJZZMJv+/hYrZBXV/xakc6 uxTypU/O nqQtvAkAfnnQFZT8iNm8JUdFwz6QGL0HTW6zvC/YlQ8wNTP0R+kOx4IACusTRaYmd1UszMWA9aV6StvPEXRN8rgyZs9tf1QydjxaPQxRqm8d5/RUvbG8uY3S0f/1MABJDn1Fyg57rAg989Y1Fe0ZKV45NodSo7publjkGuvzRReRkcFfj1DLIHJTDlI5EbWehX5P5zi+DGcAwAAeEqXmTqt/2RZNiU1X5Jk03MjRqyjOorV7jMQGdYtTEb8rXAv3ighbsMHfvQ1Ul0zo6/5KgxLa0gqLfmwbf43xZl9C+w9xI7ZxgO8E/3qmj0MgRP3yQnh/8hyh1Ui28b9eePRwHQj/aTLIFeUHEQHBFz8hvYzaKTCaGF9bkSoGbhvuqNiiswNatCvnu33vZVIw= 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 Tue 02-01-24 10:21:44, Dan Schatzberg wrote: > Hi Yu Zhao, > > Thanks for the feedback, sorry for the delayed response. > > On Thu, Dec 21, 2023 at 10:31:59PM -0700, Yu Zhao wrote: > > On Wed, Dec 20, 2023 at 8:27 AM Dan Schatzberg wrote: > > > > > > ... > > > > The cover letter says: > > "Previously, this exact interface addition was proposed by Yosry[3]." > > > > So I think it should be acknowledged with a Suggested-by, based on: > > "A Suggested-by: tag indicates that the patch idea is suggested by the > > person named and ensures credit to the person for the idea." > > from > > https://docs.kernel.org/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes > > Sure, will do. > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > index d91963e2d47f..aa5666842c49 100644 > > > --- a/mm/vmscan.c > > > +++ b/mm/vmscan.c > > > @@ -92,6 +92,9 @@ struct scan_control { > > > unsigned long anon_cost; > > > unsigned long file_cost; > > > > > > + /* Swappiness value for reclaim. NULL will fall back to per-memcg/global value */ > > > + int *swappiness; > > > > Using a pointer to indicate whether the type it points to is > > overridden isn't really a good practice. > > > > A better alternative was suggested during the v2: > > "Perhaps the negative to avoid unnecessary dereferences." > > https://lore.kernel.org/linux-mm/dhhjw4h22q4ngwtxmhuyifv32zjd6z2relrcjgnxsw6zys3mod@o6dh5dy53ae3/ > > I did have a couple versions with a negative but it creates > initialization issues where every instantiation of scan_control needs > to make sure to initialize swappiness or else it will behave as if > swappiness is 0. That's pretty error prone so using the pointer seemed > the better approach. I do agree with this. Especially for an opt-in features it is better if the default initialization has a clear meanining. In this case even if somebody doesn't use the helper then the NULL should be caught as NULL ptr rather than a silent misbehavior. -- Michal Hocko SUSE Labs