Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp7005906pxv; Fri, 30 Jul 2021 07:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrPA1eEmzskvd4UJ4svxCePbfEw9ElVwJEqbPwM9vj7cHywbokvhwq9UZ8krkKIpk6iC+i X-Received: by 2002:a17:906:64a:: with SMTP id t10mr2896777ejb.5.1627656730426; Fri, 30 Jul 2021 07:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627656730; cv=none; d=google.com; s=arc-20160816; b=sbwBFUrs4RpPiok23kFeRVQOqLY77XsOlgb+zDZObu6xqtfhdES8rALR42cLW0HCDG qXrvb/eS9q67mkodavJMG6Cha8kUgJuHu3cK34CsPzCTyNLaZACjQSmvE+9w/VlQ6qvB lr7YZ6jVjyMhQFLGwR7iAdGEDdSA0DQY4ah4m9cdN++csKSNSWlZFmzZQaOIJBgPkk4G jXjov8HBNlHoPk7zoJ+YvRZHERS9sfAzkyfwl+WWQnavgv8tOFw/vTY1XMLUUjzLQeQ4 pF2bYlCRTfgDcnOIc4jXjNgAlkKYDEzwHUSZfc2SPfD/gUsnMhcy+EdjbFEvKwFD0AO2 MpZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=VPU4h+79VaObBuUI134rKDUJewEmHD+xcV1/Q7N1298=; b=Ow0WGCXz5B6SX6WX6c1F58MSmFC2uaYhl2sZbgOWBsx+ldxDpbYIP6JQZL3jazTVnK KVzBZ4Jout4mQBkDbjw/IOSItYbi3aqb7+ND/NTkJ6ayctKTSFikkrDvwWKjtIsF87tN +lNdT07NiU1h2I6nQ7rzlBZel1fSQLsDyjtZEl8n5YJS3W7Ki7uHczJktmZTl2YsPPBU VOp57ctxHQI8WxJ9nMwoaQCbBrQwJNpoDtoSAqCw359NFg3HOF+9NpdZgRmEIEZmDG/3 GJIRkUUXXrwuMFWS5DT6DNrT8QPeSZ4FhF7tRJayM/D+zvGr/zi4IHRic9X/AKZgyBXk fUQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Q1MstY44; dkim=neutral (no key) header.i=@suse.cz header.b=cal+Icpv; 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 f17si1672293ejx.595.2021.07.30.07.51.47; Fri, 30 Jul 2021 07:52:10 -0700 (PDT) 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=@suse.cz header.s=susede2_rsa header.b=Q1MstY44; dkim=neutral (no key) header.i=@suse.cz header.b=cal+Icpv; 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 S239287AbhG3Orv (ORCPT + 99 others); Fri, 30 Jul 2021 10:47:51 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:60936 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbhG3Orv (ORCPT ); Fri, 30 Jul 2021 10:47:51 -0400 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 09B3C20258; Fri, 30 Jul 2021 14:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1627656465; 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=VPU4h+79VaObBuUI134rKDUJewEmHD+xcV1/Q7N1298=; b=Q1MstY447zOi0/z9z+Th3HozqFSuMRQmVtmRRWMekXlJqZmKudlGMsuxWb2FhD4/Sv2PCO pWV2ATU4bt3GVVQkPIQsRgKKjeKrPGXi4MB/SWXUr4aGwYcP4GWO6BjCU948BNtiyXK/19 ndWoxBMH6yF46fOe/Z6fV21MiWPrhBI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1627656465; 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=VPU4h+79VaObBuUI134rKDUJewEmHD+xcV1/Q7N1298=; b=cal+IcpvWskOYgsqK/sgaP6mNgzpiWcJNKLrCicz286AJjuT4FAseeM1Y7PNGDtT1h8IRT TnbJrIw7P4H22BAw== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id B73CC13806; Fri, 30 Jul 2021 14:47:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id PhcQLBARBGGpfQAAGKfGzw (envelope-from ); Fri, 30 Jul 2021 14:47:44 +0000 Subject: Re: [PATCH V5] mm: compaction: support triggering of proactive compaction by user To: Charan Teja Kalla , akpm@linux-foundation.org, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, dave.hansen@linux.intel.com, mgorman@techsingularity.net, nigupta@nvidia.com, corbet@lwn.net, rppt@kernel.org, khalid.aziz@oracle.com, rientjes@google.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, vinmenon@codeaurora.org References: <1627653207-12317-1-git-send-email-charante@codeaurora.org> <8fe4ba65-28e1-02d8-cf4d-74aaa76fe9df@suse.cz> <690ffed8-9c2a-1a9e-e592-a103b09e05a7@codeaurora.org> From: Vlastimil Babka Message-ID: Date: Fri, 30 Jul 2021 16:47:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <690ffed8-9c2a-1a9e-e592-a103b09e05a7@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/30/21 4:46 PM, Charan Teja Kalla wrote: > Thanks Vlastimil!! > > On 7/30/2021 7:36 PM, Vlastimil Babka wrote: >>> The proactive compaction[1] gets triggered for every 500msec and run >>> compaction on the node for COMPACTION_HPAGE_ORDER (usually order-9) >>> pages based on the value set to sysctl.compaction_proactiveness. >>> Triggering the compaction for every 500msec in search of >>> COMPACTION_HPAGE_ORDER pages is not needed for all applications, >>> especially on the embedded system usecases which may have few MB's of >>> RAM. Enabling the proactive compaction in its state will endup in >>> running almost always on such systems. >>> >>> Other side, proactive compaction can still be very much useful for >>> getting a set of higher order pages in some controllable >>> manner(controlled by using the sysctl.compaction_proactiveness). So, on >>> systems where enabling the proactive compaction always may proove not >>> required, can trigger the same from user space on write to its sysctl >>> interface. As an example, say app launcher decide to launch the memory >>> heavy application which can be launched fast if it gets more higher >>> order pages thus launcher can prepare the system in advance by >>> triggering the proactive compaction from userspace. >>> >>> This triggering of proactive compaction is done on a write to >>> sysctl.compaction_proactiveness by user. >>> >>> [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=facdaa917c4d5a376d09d25865f5a863f906234a >>> >>> Signed-off-by: Charan Teja Reddy >> Acked-by: Vlastimil Babka > > Thanks for the tag here. Np. >> >>> @@ -2895,9 +2920,16 @@ static int kcompactd(void *p) >>> while (!kthread_should_stop()) { >>> unsigned long pflags; >>> >>> + /* >>> + * Avoid the unnecessary wakeup for proactive compaction >>> + * when it is disabled. >>> + */ >>> + if (!sysctl_compaction_proactiveness) >>> + timeout = MAX_SCHEDULE_TIMEOUT; >> Does this part actually logically belong more to your previous patch that >> optimized the deferred timeouts? > > IMO, it won't fit there. Reason is that when user writes > sysctl_compaction_proactiveness = 0, it will goes to sleep with > MAX_SCHEDULE_TIMEOUT. Say now user writes non-zero value to > sysctl_compaction_proactiveness then no condition is there to wake it up > for proactive compaction, means, it will still be in sleep with > MAX_SCHEDULE_TIMEOUT. Good point! > Thus this logic is put in this patch, where, proactive compaction work > will be scheduled immediately on switch of proactiveness value from zero > to a non-zero. Agreed. Thanks! >> >