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 X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94202C433E1 for ; Wed, 1 Jul 2020 22:01:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5AA5020936 for ; Wed, 1 Jul 2020 22:01:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TaNc5gLo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AA5020936 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D0C646B010B; Wed, 1 Jul 2020 18:01:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CBCBA6B010D; Wed, 1 Jul 2020 18:01:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD25C6B010E; Wed, 1 Jul 2020 18:01:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id AB04C6B010B for ; Wed, 1 Jul 2020 18:01:18 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4033F1EF3 for ; Wed, 1 Jul 2020 22:01:18 +0000 (UTC) X-FDA: 76990878636.23.war48_240cdc126e84 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 205BC37606 for ; Wed, 1 Jul 2020 22:01:18 +0000 (UTC) X-HE-Tag: war48_240cdc126e84 X-Filterd-Recvd-Size: 5709 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Wed, 1 Jul 2020 22:01:17 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id g17so10429988plq.12 for ; Wed, 01 Jul 2020 15:01:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=LiKSdomB7SYoSNNtUaN0cjvxW4EegcZYhSh2BV0kHs4=; b=TaNc5gLo26aH/EIR7tVKCcDNRJLBctdXo/xzCJGvaYLDPUKDRRBU4MLEjLM/BdYac8 fC7XEhideABk6sVrDo4/AR5n96UerdZ4sOQx1TOffi+1kg664FfCm/YoJsH6FISUnQDM 7e+ANL/05vYi/LdyJGNVZCzLrMY8oc3igGrbK1Yvvtp90qHo/GK9jMJfQwsAkHtmP9Nq FRqwZs82SziAnAgde3r0BDCZvr+zQG3OVKkBxtUw4Cfhqk81gxQuy9dXIwNPtUsmtqRt M2+x8CpF1FL6F8L99DQ9gcuB8kBLwz4sNffvO7LaM9IJORy2y1d20NYYMRj7F3ZYe8on I6JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=LiKSdomB7SYoSNNtUaN0cjvxW4EegcZYhSh2BV0kHs4=; b=uYVFTegPDqwUrwqLKd/4aEjFsNhSkwTbwYxbVk8ozp25ryJCuaaiDiNEvJGjMvKDXA 8O2DZtsPjepSWUhoP5A1dYsdBFnK1fuNakvnh1J4uv/MVlqtPgntRtjSiKB7f80D3J/2 4i0N/ZAX8JNkzdGBfaXHwTofSrTT7bSuOcbeg4LiBZk3d92rwd4HXCBO9bOZInko75uW 3mVMV3VQkMgebMWBFYNBCabPK63GQvah4RtI5rGSYHu6XUIps/nHBYOD9FPRepgl/ZFT SXYAUy8Nf4xFZSPV+awEcSslrcv5ADgaEoyn00W0d502ku6XRQpCo/GAVOlFUkC8dDFu uIQw== X-Gm-Message-State: AOAM5326tIS1YU9y4RCVEbYhwWr1kXYK2u4t9GqWGnC9FEvVKuEKmLj9 RHU3bfYFqMwzljZwb83kp7nFHA== X-Google-Smtp-Source: ABdhPJz8In3fDXWpo9ag7N61J3Dc64PVECUjKJ4bfAdcKZEGlI5+yqvtAF1B235h/YKVwdjy25NVag== X-Received: by 2002:a17:90b:1103:: with SMTP id gi3mr29890330pjb.110.1593640876247; Wed, 01 Jul 2020 15:01:16 -0700 (PDT) Received: from [2620:15c:17:3:4a0f:cfff:fe51:6667] ([2620:15c:17:3:4a0f:cfff:fe51:6667]) by smtp.gmail.com with ESMTPSA id b8sm6010381pja.54.2020.07.01.15.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 15:01:15 -0700 (PDT) Date: Wed, 1 Jul 2020 15:01:14 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Dave Hansen cc: Dave Hansen , linux-kernel@vger.kernel.org, linux-mm@kvack.org, alex.shi@linux.alibaba.com, dwagner@suse.de, tobin@kernel.org, cl@linux.com, akpm@linux-foundation.org, ying.huang@intel.com, dan.j.williams@intel.com, cai@lca.pw Subject: Re: [PATCH 3/3] mm/vmscan: replace implicit RECLAIM_ZONE checks with explicit checks In-Reply-To: <0dd57932-44cf-0c2d-e157-07a8d7324006@intel.com> Message-ID: References: <20200701152621.D520E62B@viggo.jf.intel.com> <20200701152627.8761147E@viggo.jf.intel.com> <20200701200446.ki5hdgarcpmo2vuf@intel.com> <0dd57932-44cf-0c2d-e157-07a8d7324006@intel.com> User-Agent: Alpine 2.23 (DEB 453 2020-06-18) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 205BC37606 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: On Wed, 1 Jul 2020, Dave Hansen wrote: > On 7/1/20 1:04 PM, Ben Widawsky wrote: > >> +static inline bool node_reclaim_enabled(void) > >> +{ > >> + /* Is any node_reclaim_mode bit set? */ > >> + return node_reclaim_mode & (RECLAIM_ZONE|RECLAIM_WRITE|RECLAIM_UNMAP); > >> +} > >> + > >> extern void check_move_unevictable_pages(struct pagevec *pvec); > >> > >> extern int kswapd_run(int nid); > > If a user writes a bit that isn't a RECLAIM_* bit to vm.zone_reclaim_mode > > today, it acts as though RECLAIM_ZONE is enabled: we try to reclaim in > > zonelist order before falling back to the next zone in the page allocator. > > The sysctl doesn't enforce any max value :/ I dont know if there is any > > such user, but this would break them if there is. > > > > Should this simply be return !!node_reclaim_mode? > > You're right that there _could_ be a user-visible behavior change here. > But, if there were a change it would be for a bit which wasn't even > mentioned in the documentation. Somebody would have had to look at the > doc mentioning 1,2,4 and written an 8. If they did that, they're asking > for trouble because we could have defined the '8' bit to do nasty things > like auto-demote all your memory. :) > > I'll mention it in the changelog, but I still think we should check the > actual, known bits rather than check for 0. > > BTW, in the hardware, they almost invariably make unused bits "reserved" > and do mean things like #GP if someone tries to set them. This is a > case where the kernel probably should have done the same. It would have > saved us the trouble of asking these questions now. Maybe we should > even do that going forward. > Maybe enforce it in a sysctl handler so the user catches any errors, which would be better than silently accepting some policy that doesn't exist? RECLAIM_UNMAP and/or RECLAIM_WRITE should likely get -EINVAL if attempted to be set without RECLAIM_ZONE as well: they are no-ops without RECLAIM_ZONE. This would likely have caught something wrong with commit 648b5cf368e0 ("mm/vmscan: remove unused RECLAIM_OFF/RECLAIM_ZONE") if it would have already been in place. I don't feel strongly about this, so feel free to ignore.