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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 1CAB7C433E0 for ; Wed, 3 Mar 2021 17:48:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B19F7601FD for ; Wed, 3 Mar 2021 17:48:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B19F7601FD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2E4CD8D018D; Wed, 3 Mar 2021 12:48:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2945F8D0157; Wed, 3 Mar 2021 12:48:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E8488D018D; Wed, 3 Mar 2021 12:48:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id E33988D0157 for ; Wed, 3 Mar 2021 12:48:04 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9757F18132D06 for ; Wed, 3 Mar 2021 17:48:04 +0000 (UTC) X-FDA: 77879296488.18.5AA55F5 Received: from m42-2.mailgun.net (m42-2.mailgun.net [69.72.42.2]) by imf26.hostedemail.com (Postfix) with ESMTP id 7212840B8CDB for ; Wed, 3 Mar 2021 17:47:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1614793676; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=Fcd2CI16BjPfDlrMPeOLMsbcVTQCVnoyX8FWXapXUqY=; b=g8a4ODgffO560+i5bxZmFuKQ/gQb7+cdnm58xiXozqYlze19f0RL0CdF7+Y09QvmDoQbVlPu zk4D4gFBpEMQEjo6EFFAB5KdSVQ3MBGrgUrfWtMMGikixjRlKTVoDI/92v72k5NouZeKqbz7 HRuAmPpS05s49BOYOWFpPK5XbQc= X-Mailgun-Sending-Ip: 69.72.42.2 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 603fcbc71a5c93533f5831e1 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 03 Mar 2021 17:47:51 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 26A9DC43461; Wed, 3 Mar 2021 17:47:50 +0000 (UTC) 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 X-Stat-Signature: 8nhbgkmcmqwyo4t4z1yxo6j6d1g8gbaa X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 7212840B8CDB Received-SPF: none (mg.codeaurora.org>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=m42-2.mailgun.net; client-ip=69.72.42.2 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614793679-48166 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 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