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 DEB90C4167D for ; Tue, 12 Dec 2023 21:27:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 75E796B03B0; Tue, 12 Dec 2023 16:27:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 70E3A6B03B1; Tue, 12 Dec 2023 16:27:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 588436B03B2; Tue, 12 Dec 2023 16:27:17 -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 45EB36B03B0 for ; Tue, 12 Dec 2023 16:27:17 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 12CFB40A5B for ; Tue, 12 Dec 2023 21:27:17 +0000 (UTC) X-FDA: 81559452114.26.D71112B Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf02.hostedemail.com (Postfix) with ESMTP id 3446380026 for ; Tue, 12 Dec 2023 21:27:15 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=US2cEzw3; spf=pass (imf02.hostedemail.com: domain of schatzberg.dan@gmail.com designates 209.85.215.179 as permitted sender) smtp.mailfrom=schatzberg.dan@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702416435; 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=mGU0tRhB9g2my+2/cE06clpBuE4ux9GMlKQnA88vmOY=; b=bz8lr9DqoGXx8acCnULts1jcVZrbWrXtiR5HpiACTtlms0jD20c0W+LBDqM/OadPAFlPMX 8BDBGfucKvBDgaedmcUgyqLUCkTvM8FttpVb0qjCs3myVDfGhR7SEk/9sYw7YuOcBgD9GR XajXn+kjbTm1rZ/oz/tyM5anZr5xEjs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702416435; a=rsa-sha256; cv=none; b=X3KM4tNOht/IJCHKQv+tuKfrUPD+QNHCR1Mbb/romdxMNGIEuaPY2/cWUUuC8wxL/Wf2Xt ao7uV34fImmJs8cW0TFEuZ+iLQMa5buTGToBrUKWOe1BqbjnyuDUZVLAtrmYuebazmvyVT IdBjv3J5FPTNU7ASwU2S8rgQCj13C1Y= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=US2cEzw3; spf=pass (imf02.hostedemail.com: domain of schatzberg.dan@gmail.com designates 209.85.215.179 as permitted sender) smtp.mailfrom=schatzberg.dan@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-5c701bd9a3cso1547330a12.0 for ; Tue, 12 Dec 2023 13:27:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702416434; x=1703021234; darn=kvack.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=mGU0tRhB9g2my+2/cE06clpBuE4ux9GMlKQnA88vmOY=; b=US2cEzw38RYOkgOubnmN3Dn4pXnu/ITphuORaLbMcmGDXAAT7hnqk5nQlqTgaZGy+O Zdf4wT/XtPUcWxTz/g5cBKxMIz6ea7OQ1yXe9mUyq0//dZiW+Bf9Prfst9dwuU6YhOz+ +acaEodo5dwmfeI6XXVwlnBtGTiL44Fxw9x8jysGPEp8Z1BAQzFo37hXh/ihwTqLWHPL iL5glULRk0m/u4EDEOGlY3V7obqY3IUGbObQhFaEwUA+/u6c/m/tgo1JpxQwjSH0Ox/w d62CzT9cXt4m8JcNXJitlbc4t9o0Lw/UpbzXvTziyssN4IFgzcFegfnf32rSy1UKpYxc 5eWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702416434; x=1703021234; h=in-reply-to:content-transfer-encoding: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=mGU0tRhB9g2my+2/cE06clpBuE4ux9GMlKQnA88vmOY=; b=XoL5nKhUAOCIfleGq3oPIbPXclD0zDX9rjp7Y8PGChcFh8w/ltqQW8H+RCvL3Fm7El 3o3kFweB4Az3yV8fXNpa3W3OpPJZAR48lyjtaDOzdEVH0emIDb82tJqbDPJ3YtmV1ViE Ixt7jZ4rPuJ8U0HPDchkrIFUfiJsHWFkXcJUveDytlI0GBO0tb04KHVCuvmF47zzS3pW ibDKMoIwicfEf73iQ24AWl5ElRA355aMpb2T+uKLX+InsGfq/M6mOsxr3sskM9JxLxT8 bTLHLtGZsmavQNRYAU1A0FU/kUMdDvlHfK9DomxGb6cF5kBqO9JM+gJhbQzfHPpM2GfX Nu0g== X-Gm-Message-State: AOJu0Yw8MoR0Nkp5Hr9NgGKKWr9E8SLqlGpzf2Qf+yGbdxf9IQ6Ux/9j u2q/WqzgnbBTDr47ZNTLbYg= X-Google-Smtp-Source: AGHT+IEOqV6YioHzLz+CMzevAybZpWI90BvWGUhoOK81GcGWs2eSGpaD9M4nWE3MXP3iEb5BjRySyQ== X-Received: by 2002:a05:6a20:3d1e:b0:18f:b870:e9b3 with SMTP id y30-20020a056a203d1e00b0018fb870e9b3mr3562327pzi.121.1702416433791; Tue, 12 Dec 2023 13:27:13 -0800 (PST) Received: from dschatzberg-fedora-PF3DHTBV ([2620:10d:c090:500::5:671e]) by smtp.gmail.com with ESMTPSA id z21-20020a656115000000b0059d219cb359sm7504411pgu.9.2023.12.12.13.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 13:27:13 -0800 (PST) Date: Tue, 12 Dec 2023 16:27:09 -0500 From: Dan Schatzberg To: Yosry Ahmed Cc: Johannes Weiner , Roman Gushchin , Huan Yang , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Tejun Heo , Zefan Li , Jonathan Corbet , Michal Hocko , Shakeel Butt , Muchun Song , Andrew Morton , David Hildenbrand , Matthew Wilcox , Chris Li , Kefeng Wang , "Vishal Moola (Oracle)" , Yue Zhao , Hugh Dickins Subject: Re: [PATCH V3 1/1] mm: add swapiness= arg to memory.reclaim Message-ID: References: <20231211140419.1298178-1-schatzberg.dan@gmail.com> <20231211140419.1298178-2-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: 3446380026 X-Rspam-User: X-Stat-Signature: 5u5ips48w47sonufuaio58q981pyuoqn X-Rspamd-Server: rspam03 X-HE-Tag: 1702416435-410188 X-HE-Meta: U2FsdGVkX19g3aO44HroUuYtOScdD+C0qY+RJ3r8lC7r5K3izIz3lUVOtrpgajvhF4rFWJzuBxlO0BBc4Ydi+w1/YrtU77FNFiOon+Sf+9s1JBj1MJACl314R1B9CAmYgsS42PeFVBdYbqTlK8dKimFITWlGjdA/opN2ddSPnQphTWIAPRkC6sLTmTR7uinm0Nxgh9LlSVARNjOZjAkcZ9rPdua6JiyYWqf4S5slfk6YBRF+lIGK44DrnqA7b1W7L6M5c+ZvAzBJg1DDqXjrShpOQ+30fDO61qL0KYnzSy+Aya0M6s1FlMLEk9revQoBcjp4gM8i16q85tVzZ2chjA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ivqWtRonSxqFucPHHAAZIuQVCqOOUf7QTuc42OqfsTtAE3yecubBECKRuyV4KdEl1SHhLhe7RBKRKthV/MrEoAAdOTjVdh9434pPxelsxAmDwmLupRyWucYYrYIbNbt5bEtuRL6l7feQElDlpomtAgc3+47JprmfSV8ZQzrtFyWdXgtsCn5vzstK2ff5I= 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 Mon, Dec 11, 2023 at 11:41:24AM -0800, Yosry Ahmed wrote: > On Mon, Dec 11, 2023 at 6:04 AM Dan Schatzberg wrote: > > contains* the* > > I think this statement was only important because no keys were > supported, so I think we can remove it completely and rely on > documenting the supported keys below like other interfaces, see my > next comment. > > > + to reclaim. > > > > Example:: > > > > @@ -1304,6 +1304,17 @@ PAGE_SIZE multiple when read back. > > This means that the networking layer will not adapt based on > > reclaim induced by memory.reclaim. > > > > + This file also allows the user to specify the swappiness value > > + to be used for the reclaim. For example: > > + > > + echo "1G swappiness=60" > memory.reclaim > > + > > + The above instructs the kernel to perform the reclaim with > > + a swappiness value of 60. Note that this has the same semantics > > + as the vm.swappiness sysctl - it sets the relative IO cost of > > + reclaiming anon vs file memory but does not allow for reclaiming > > + specific amounts of anon or file memory. > > + > > Can we instead follow the same format used by other nested-keyed files > (e.g. io.max)? This usually involves a table of supported keys and > such. Thanks, both are good suggestions. Will address these. > > + while ((start = strsep(&buf, " ")) != NULL) { > > + if (!strlen(start)) > > + continue; > > + switch (match_token(start, if_tokens, args)) { > > + case MEMORY_RECLAIM_SWAPPINESS: > > + if (match_int(&args[0], &swappiness)) > > + return -EINVAL; > > + if (swappiness < 0 || swappiness > 200) > > I am not a fan of extending the hardcoded 0 and 200 values, and now > the new -1 value. Maybe it's time to create constants for the min and > max swappiness values instead of hardcoding them everywhere? This can > be a separate preparatory patch. Then, -1 (or any invalid value) can > also be added as a constant with a useful name, instead of passing -1 > to all other callers. > > This should make the code a little bit more readable and easier to extend. I'm not sure I understand the concern. This check just validates that the swappiness value inputted is between 0 and 200 (inclusive) otherwise the interface returns -EINVAL. Are you just concerned that these constants are not named explicitly so they can be reused elsewhere in the code?