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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E9B3C678D5 for ; Wed, 8 Mar 2023 10:21:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230270AbjCHKV1 (ORCPT ); Wed, 8 Mar 2023 05:21:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjCHKVT (ORCPT ); Wed, 8 Mar 2023 05:21:19 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74B73B6D36; Wed, 8 Mar 2023 02:21:18 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 291861FE35; Wed, 8 Mar 2023 10:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1678270877; h=from:from:reply-to: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; bh=JZa0zpAJCeh9dzklwAiQIDL273b6n4qNFXa7CBwrKNI=; b=P089fFIeokxOaKc2AugIP592HPZ9E/nYJdJaAkitiG8p5Ny8rI79+EnhcDQCGz3R80NA4u 4p8N9UiD2Nh70cxcV9TGbYAbKGjOaZWjw5frB5ihLE6ZSznFoOb9m8XqiXebpCeXd2Q7Vv LiNy0WDoavyfWfCdREY9NwlnuS0csCc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1678270877; h=from:from:reply-to: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; bh=JZa0zpAJCeh9dzklwAiQIDL273b6n4qNFXa7CBwrKNI=; b=iFNnLRikDeqTC1JTbHAm9Z0Vf4a2PwibCfkX9pPQ49UiGyZR/4OD43yKaCgRxz2JlglRCI DNjm22/74WXOySDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E834F1391B; Wed, 8 Mar 2023 10:21:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1LqXN5xhCGSFWQAAMHmgww (envelope-from ); Wed, 08 Mar 2023 10:21:16 +0000 Message-ID: <83344b3d-1de1-f3c2-913c-a8c54ce7a99f@suse.cz> Date: Wed, 8 Mar 2023 11:21:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH V2 1/2] sysctl: Limit the value of interface compact_memory Content-Language: en-US To: ye.xingchen@zte.com.cn, mcgrof@kernel.org Cc: keescook@chromium.org, yzaikin@google.com, akpm@linux-foundation.org, linmiaohe@huawei.com, chi.minghao@zte.com.cn, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org References: <202303061407332798543@zte.com.cn> From: Vlastimil Babka In-Reply-To: <202303061407332798543@zte.com.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/6/23 07:07, ye.xingchen@zte.com.cn wrote: > From: Minghao Chi > > In Documentation/admin-guide/sysctl/vm.rst:109 say: when 1 is written > to the file, all zones are compacted such that free memory is available > in contiguous blocks where possible. > So limit the value of interface compact_memory to 1. > > Link: https://lore.kernel.org/all/ZAJwoXJCzfk1WIBx@bombadil.infradead.org/ I don't think the split to two patches you did, achieves Luis' request. > Signed-off-by: Minghao Chi > Signed-off-by: Ye Xingchen > > --- > include/linux/compaction.h | 1 + > kernel/sysctl.c | 4 +++- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/include/linux/compaction.h b/include/linux/compaction.h > index 52a9ff65faee..caa24e33eeb1 100644 > --- a/include/linux/compaction.h > +++ b/include/linux/compaction.h > @@ -81,6 +81,7 @@ static inline unsigned long compact_gap(unsigned int order) > } > > #ifdef CONFIG_COMPACTION > +extern int sysctl_compact_memory; > extern unsigned int sysctl_compaction_proactiveness; > extern int sysctl_compaction_handler(struct ctl_table *table, int write, > void *buffer, size_t *length, loff_t *ppos); > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > index c14552a662ae..67f70952f71a 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -2192,10 +2192,12 @@ static struct ctl_table vm_table[] = { > #ifdef CONFIG_COMPACTION > { > .procname = "compact_memory", > - .data = NULL, > + .data = &sysctl_compact_memory, I doubt this compiles/links without patch 2, as there's no definition until patch 2. > .maxlen = sizeof(int), > .mode = 0200, > .proc_handler = sysctl_compaction_handler, > + .extra1 = SYSCTL_ONE, > + .extra2 = SYSCTL_ONE, > }, > { > .procname = "compaction_proactiveness", IIUC his request was to move the compaction entries out of sysctl.c?