Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp894525rdb; Tue, 30 Jan 2024 01:36:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6gKnd6brhDkb7LGK+joetpzkNeGQkGn0RZ2hP8Q7PPy5Mon4NxDGxrtVTGI8t1O+TpRYY X-Received: by 2002:ad4:5fcc:0:b0:68c:4632:b71a with SMTP id jq12-20020ad45fcc000000b0068c4632b71amr5367183qvb.60.1706607385589; Tue, 30 Jan 2024 01:36:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706607385; cv=pass; d=google.com; s=arc-20160816; b=nQVNF+JZGpd+QMAqxRLlixhAqva95busNBfUQCTwIM4mwXnwbSnrkV4iJL7jpOLVb3 1qk9uK/EtwwsJIkk57k8Z75B8mVd0yxgS+jTL1dgyeA1CVU2ek8QIUTcfQ2X+LMPBW+r F14Pblq7TGI0ry99/ldooTsAfpKlpQ4EK+lgeOMnpj8bvoWbaBV+O7Li/PsloflJnsxb 1xHEOkxB2ERn09X4ccTvXFCR1Cv/GazEDAZRwgBp2E0Je+sl9BlprXggo/heSv2DrDb2 2XjsdjXG/0IoVRe93DLibzmAH70W4YdMVRL9sLNfWD/MYcR7CCG0tmDlBItdQ2JPFR7X orGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=PHkeiCNSJCal3HVcuXxyv9aH6tYkcVNIKrc28/mzGBo=; fh=JGdrvN/w012dnbjKJ0JfB9VQZcMFPbKXDl1w1lOCUDw=; b=hfpYa4ykYgxK+rcCgj86wBW1Y1pVjvI2yJ0iLn6j7ILjIOOCAUlv1j5gWmkUQm2RcJ yIJdOutLqpyOb5cYfbgRluPx65bIIdRy0MaKRCNTa10w5VkfOZXyZ0Rw7N80CvVhvdRT AFtvJqhEW8iWIVgAVDXTpHU/JnpoePoREGkzwGwMQwytA7fKlNUV1thVTONKmaAQSHrw Czp2M/LanjwgfRpFn0w3g7UxLtaOXi6BJ9H5At82jZY1hnCZsSwYzhlHjadZ1wGl3Y3C zwXz4ar883WciOvROU8pExSrI8GxKlt+BQeWXPJyQiFF/UfjZ8cfdDo9z3c9czVu+8bj +pDg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fCMZrZ2D; dkim=pass header.i=@suse.com header.s=susede1 header.b=fCMZrZ2D; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-44266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fn8-20020ad45d68000000b00680c767ca46si9774642qvb.12.2024.01.30.01.36.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 01:36:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=fCMZrZ2D; dkim=pass header.i=@suse.com header.s=susede1 header.b=fCMZrZ2D; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-44266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 43D1A1C26743 for ; Tue, 30 Jan 2024 09:35:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A5B0605B1; Tue, 30 Jan 2024 09:35:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="fCMZrZ2D"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="fCMZrZ2D" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3A2B18E25 for ; Tue, 30 Jan 2024 09:35:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706607350; cv=none; b=DdC9GJ697WRzFnhyBqc/1fZnjliNvmGL1jGXavfUpp/sS1q6fsuC9va4KAHs/MyshXU11Rete/jGr9jXNJOJdP+5UVfKL15ruC+6WpqTr0slmKNmc1Q9RV7qLaYUf07llLZsJdj/lJhGYl+O6te6oz2LK0/WLL4olwZ5Z9B1rmo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706607350; c=relaxed/simple; bh=1QV+rYj9+mAOul+iX5Lkt6vwyTL5vO4DQanHTMrWgi8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YHbpD6aoBWF+mD6yByJ8X8V6bMufO6M6tHFVpSrOvEoklhh+86c7p3dif2clJmGnUmn7TgQUhCgH8eU0rwIfJzRnsU3R8TMpT1kfyL8F4sFk4yTlBGyD4oJG7XSeTS3YXZmcoxZvO+s5pPGSisnmTCPmgrRoQ1AkqpB5Dd9lfZY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=fCMZrZ2D; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=fCMZrZ2D; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A0CB221DF4; Tue, 30 Jan 2024 09:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706607345; 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=PHkeiCNSJCal3HVcuXxyv9aH6tYkcVNIKrc28/mzGBo=; b=fCMZrZ2DVjQXelsv6h/YB/zS3aF3KiW7Pzr5RQqS4xBmenCplxkOIS9gYvrpqVxIqIPm2y dAVdfqLKRFHNjhFWMW5d+LibMsUmtO0pabX0RfLHeAQWJjyBIFnwC5t0C6Q3Zh1glDLswm khKMGgZufmuuqZQGjkrt6eud1p402NU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706607345; 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=PHkeiCNSJCal3HVcuXxyv9aH6tYkcVNIKrc28/mzGBo=; b=fCMZrZ2DVjQXelsv6h/YB/zS3aF3KiW7Pzr5RQqS4xBmenCplxkOIS9gYvrpqVxIqIPm2y dAVdfqLKRFHNjhFWMW5d+LibMsUmtO0pabX0RfLHeAQWJjyBIFnwC5t0C6Q3Zh1glDLswm khKMGgZufmuuqZQGjkrt6eud1p402NU= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7602913A6A; Tue, 30 Jan 2024 09:35:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MxG9GfHCuGXlIwAAD6G6ig (envelope-from ); Tue, 30 Jan 2024 09:35:45 +0000 Date: Tue, 30 Jan 2024 10:35:40 +0100 From: Michal Hocko To: Lance Yang Cc: akpm@linux-foundation.org, zokeefe@google.com, david@redhat.com, songmuchun@bytedance.com, shy828301@gmail.com, peterx@redhat.com, minchan@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] mm/khugepaged: bypassing unnecessary scans with MMF_DISABLE_THP check Message-ID: References: <20240129054551.57728-1-ioworker0@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [0.24 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_SEVEN(0.00)[10]; FREEMAIL_TO(0.00)[gmail.com]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_CC(0.00)[linux-foundation.org,google.com,redhat.com,bytedance.com,gmail.com,kernel.org,kvack.org,vger.kernel.org]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.16)[69.28%] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: 0.24 On Tue 30-01-24 11:08:10, Lance Yang wrote: > On Tue, Jan 30, 2024 at 10:12 AM Lance Yang wrote: > > > > Hey Michal, > > > > Thanks for taking time to review! > > > > On some servers within our company, we deploy a > > daemon responsible for monitoring and updating > > local applications. Some applications prefer not to > > use THP, so the daemon calls prctl to disable THP > > before fork/exec. Conversely, for other applications, > > the daemon calls prctl to enable THP before fork/exec. > > > > Ideally, the daemon should invoke prctl after the fork, > > but its current implementation follows the described > > approach. > > In the Go standard library, there is no direct encapsulation > of the fork system call. Instead, fork and execve are > combined into one through syscall.ForkExec. OK, this is an important detail. Something that should be a part of the chnagelog. It is also important to note that this is not a correctness issue but rather an optimization to save expensive checks on each VMA when userspace cannot prctl itself before spawning into the new process. -- Michal Hocko SUSE Labs