Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2209308imu; Thu, 24 Jan 2019 08:57:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN6zNiZq6rup071jUG/XEPy1pm5rzGquk3+iKlpEHVmbOrV2SW8gy7tjCrqX/O2yFVKtj+z6 X-Received: by 2002:a63:e74b:: with SMTP id j11mr6629564pgk.397.1548349049059; Thu, 24 Jan 2019 08:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548349049; cv=none; d=google.com; s=arc-20160816; b=RBwzaISYOrYiFm8Ys+9jy812TWjy3p1xFuz3L9tIakw7vvZAPw7Bje87VzacxouBli 2RTM+coRftKQUOA/w9/RtDw9jT9dmuAtC9qiE/Vx5D0typqIYsSWCDsNsRWnm10sz04q K2JSlQMYKH7OTax4sFsxqMBn6cka1xLE9uLEAfIPyB5YOPFHw7S5TbCGko4jYDUv8yhu 4sIEO6JoVLY8Qvq6y2BnyXCz7bMTkps4hH5JAMUas8riAsvzFnIRPLtf3LwX4rY0Wtqq 5tod7BaMRG4SsbhHlGtLn3xFMXecblLsKQ3aL9PXTpjTKOJnSTMyUppP6lHf6PZO/U0h 2TvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/n5RO3ynJj5/bNE9tmIzk4EgTVnmQBOVPbiCNZWucCY=; b=ar6tLq+hAz9mGpARl1JqKonYKxdSpKKbbf/FdKEBnkwYcJ2UxagoLywoAlmy5EJ/iZ VCwBT3cJNIVK1CfB870GpmFEgDoxEDP9bkeKuK7uFiyVhUYZGWysC25MgBMwwqecdraN 6SudI0OWCpb95fVCIUXQN8XMm87NHeSpFrMtfoIg6KR3y1L4HcgwADn9X3/rGpXAUCIA Ra1vzg3J8AgbSny8fwgkNTXBUMlh+KSoeLEw8VNOmOnZR8XQMfOL0fSYl6lr98LgPxg0 Zdv9P0CFBlj3Qv0PAF9xhFwb9m6xme+ehF45ZTslQefK+yK43sRq8CLbCMYct/MryJkB qnbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=YKWa4jgi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21si21417376plo.165.2019.01.24.08.57.09; Thu, 24 Jan 2019 08:57:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=YKWa4jgi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727852AbfAXQ4i (ORCPT + 99 others); Thu, 24 Jan 2019 11:56:38 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:40657 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727443AbfAXQ4h (ORCPT ); Thu, 24 Jan 2019 11:56:37 -0500 Received: by mail-yw1-f65.google.com with SMTP id g194so2685744ywe.7 for ; Thu, 24 Jan 2019 08:56:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/n5RO3ynJj5/bNE9tmIzk4EgTVnmQBOVPbiCNZWucCY=; b=YKWa4jgiYZ79VkYeO8kCZgz1L1IMeQnAHkMW+GVd2NfaNUXvRA6B7g/3RPcFoQVc6O 0tvrfJrA8IDHOdaGmgsDJ8trxGoio6EUvlkDrQBuR0wQIpBM/6QhLqHCdRbvUJlt9tTd PZ7QeIDKBV9N5XPgf+MVl1Ix8wDc2uxHANCMk= 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:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/n5RO3ynJj5/bNE9tmIzk4EgTVnmQBOVPbiCNZWucCY=; b=sic550JQ6aQ26jndwdSgUyiR06zu66ss4DK5yU+EP4qtAuSTe1ivNw/GDhOTMrROq/ rxcxUdcSUf0qHRRX8JsGvSZRWOQIk8b8IuPguekxHRqKbwLGUNPkhsmXO+SGS9CEI6Uo kYhMPPbbYMHAKawLas4NDsDQbIQDgTZ/vjgBuik+7n3wZCwBRVp3tepwXB05xLCBD+9c i6wONP84Tpt3h8C7gschfOKi+AI4KWRk5wwdAA4ew+3R+H8dBESvH5EaA6emX2pkIBNV CgfsvEynhalouw2ioztLSfX0Wc67Ed4iQLU5g9Pp4EN5LQ8cMl8CK2xR90f90dagGR7h +jZQ== X-Gm-Message-State: AJcUukefsmLf9ctDFj42x26lmkKwEylOMlvbHPbyz63qtIcknAw0oANK T3vBHSArwDuB6IIUVy44xpQ5ZAK6kzoh8Q== X-Received: by 2002:a81:1492:: with SMTP id 140mr7035640ywu.333.1548348996097; Thu, 24 Jan 2019 08:56:36 -0800 (PST) Received: from localhost ([2620:10d:c091:200::7:d7cc]) by smtp.gmail.com with ESMTPSA id n2sm10876374ywe.37.2019.01.24.08.56.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 24 Jan 2019 08:56:35 -0800 (PST) Date: Thu, 24 Jan 2019 11:56:34 -0500 From: Chris Down To: Johannes Weiner Cc: Andrew Morton , Tejun Heo , Roman Gushchin , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, kernel-team@fb.com Subject: Re: [PATCH] mm: Move maxable seq_file logic into a single place Message-ID: <20190124165634.GA13549@chrisdown.name> References: <20190124061718.GA15486@chrisdown.name> <20190124160935.GB12436@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20190124160935.GB12436@cmpxchg.org> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Johannes Weiner writes: >I think this increases complexity more than it saves LOC, >unfortunately. > >The current situation is a bit repetitive, but much more obviously >correct. And we're not planning on adding many more of those memcg >interface files, so I this doesn't seem to be an improvement re: >maintainability and future extensibility of the code. Hmm, my main goal in the patch was not really reduction of LOC, but more around centralising logic so that it's clear where these functions are unique and where they are completely the same. My initial reaction upon reading these was mostly to feel like I'm missing something due to the large amount of similarity between them, wondering if the change in mem_cgroup/page_counter access is really the only thing to look at, so my goal was primarily to reduce confusion (although of course this is subjective, I can also see your point about how having "memory.low" and the like without context can also be confusing). I think using a macro is not ideal, but unfortunately without it a lot of the complexity can't really be abstracted easily. If not this, what would you think about a patch that adds two new functions: 1. mem_cgroup_from_seq 2. mem_cgroup_write_max_or_val This won't be able to reduce as much of the overlap as the macro, but it still will centralise a lot of the logic.