Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1583284pxb; Thu, 4 Mar 2021 15:27:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyX8G2Kir6rvo3L60W0JqWZE/5+KT/wBt+16GytlBIhVWdNcPOkpClqz6CYIrLPS3bTHIn8 X-Received: by 2002:a17:906:388d:: with SMTP id q13mr6853696ejd.34.1614900474104; Thu, 04 Mar 2021 15:27:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614900474; cv=none; d=google.com; s=arc-20160816; b=M8wQL9pcT5IopSivIbWHDbn5Bi9Xq83Rcat+24RBN2JO/u9kZPUK83XXPxOw0F52lU ZdJ5h+ZlN/RE42i3Df1u63tgijQKdv/Ogm1/Fo3DwhTwY73PgcWyuaVt30Mfxa65MInX IaNEAkVyDl5dSjnUYUERaZPh5+cPPtQNwgf18TYuxlPUKFDcBOfMlBFnLQW6Ak2+tawO 23CS8w2wvFsqAnQT+LwWMkcM/C946dcY+yvMrY8D2dJW11vnskfqEa/VEeDrJjFKPfxT lThgPN/f+uNlFGCHogVqAfoyxEogunTURTATC5YYYb0+eIo9WfXCwQCUvDE5asFVeLxc rRSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=Fcd2CI16BjPfDlrMPeOLMsbcVTQCVnoyX8FWXapXUqY=; b=Wr0oAMcabMakyOk8+zPXcm7lnSbATWNTi5tG9HfmHcDc2E8+HZ/TxHmJHHh7aIWLpC xIitWMeP3WCK1F3cg2RMve+hveH3M8w4YJiuqSw2hqn/biivsSzGkQ0Xyi+BaG2EoKpn 9yKXnGdNT7G3EOIbvkr799MHmkTT5Xw1bEBfuIvh8RyMj4wbIPAxuA8+ARMJdCp03QpP c9uODP3OuMK+vwesWMS9BqLTSeDYHqU57Y5w01aU/LWspXEgVg27qE/UmKVkQDUI4Vye DmWqbL5fjceaiTkAuxBPS9hagtkNWqZofMEonPODCrMFuNnMTlFEMsHPCxw/9uZNNtfb 0V/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="GnDx9/GY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si331131eje.581.2021.03.04.15.27.30; Thu, 04 Mar 2021 15:27:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="GnDx9/GY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836475AbhCCSrw (ORCPT + 99 others); Wed, 3 Mar 2021 13:47:52 -0500 Received: from z11.mailgun.us ([104.130.96.11]:18075 "EHLO z11.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1577590AbhCCRsz (ORCPT ); Wed, 3 Mar 2021 12:48:55 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1614793711; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=Fcd2CI16BjPfDlrMPeOLMsbcVTQCVnoyX8FWXapXUqY=; b=GnDx9/GYg35KAio5fixk9BAvgufq71f2X6/QJk97jwr531YCTttrSTHVrPc652LEVs5feofi RWvTJM+eYJNknTXMKBCgryAHaSxrcrT1jfn/QIOqTVUY3ixwp99iKj90AQJX/jvoh7DFXMH3 /nfjUoHkvgmrMcfXc3cqDGT9/dQ= X-Mailgun-Sending-Ip: 104.130.96.11 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-west-2.postgun.com with SMTP id 603fcbc6c862e1b9fdb26fdb (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 03 Mar 2021 17:47:50 GMT Sender: pintu=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C4B74C433CA; Wed, 3 Mar 2021 17:47:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: pintu) by smtp.codeaurora.org (Postfix) with ESMTPSA id 708BEC433ED; Wed, 3 Mar 2021 17:47:49 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 03 Mar 2021 23:17:49 +0530 From: pintu@codeaurora.org To: Vlastimil Babka Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, iamjoonsoo.kim@lge.com, sh_def@163.com, mateusznosek0@gmail.com, bhe@redhat.com, nigupta@nvidia.com, yzaikin@google.com, keescook@chromium.org, mcgrof@kernel.org, mgorman@techsingularity.net, pintu.ping@gmail.com Subject: Re: [PATCH] mm/compaction: remove unused variable sysctl_compact_memory In-Reply-To: <486d7af3-95a3-9701-f0f9-706ff49b99d1@suse.cz> References: <1614707773-10725-1-git-send-email-pintu@codeaurora.org> <486d7af3-95a3-9701-f0f9-706ff49b99d1@suse.cz> Message-ID: X-Sender: pintu@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-03-03 22:39, Vlastimil Babka wrote: > On 3/2/21 6:56 PM, Pintu Kumar wrote: >> The sysctl_compact_memory is mostly unsed in mm/compaction.c >> It just acts as a place holder for sysctl. >> >> Thus we can remove it from here and move the declaration directly >> in kernel/sysctl.c itself. >> This will also eliminate the extern declaration from header file. >> No functionality is broken or changed this way. >> >> Signed-off-by: Pintu Kumar >> Signed-off-by: Pintu Agarwal > > You should be able to remove the variable completely and set .data to > NULL in > the corresponding entry. The sysctl_compaction_handler doesn't access > it at all. > > Then you could do the same with drop_caches. Currently > drop_caches_sysctl_handler currently writes to it, but that can be > avoided using > a local variable - see how sysrq_sysctl_handler avoids the global > variable and > its corresponding .data field is NULL. > Oh yes, thank you so much for the reference. Yes I was looking to do something similar but didn't realize that is possible. I will re-submit the new patch. And yes, I will try to explore more on drop_caches part as well. Thanks, Pintu