Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp497299rdb; Mon, 29 Jan 2024 08:33:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnSVTJv21986w+wG7BIsNdVXs42+0UTNzmevx3IzoRKEKhyvemHOxqoHtjnxoRsonLmm+h X-Received: by 2002:a17:906:1c02:b0:a30:d5ae:2833 with SMTP id k2-20020a1709061c0200b00a30d5ae2833mr4776376ejg.56.1706546004628; Mon, 29 Jan 2024 08:33:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706546004; cv=pass; d=google.com; s=arc-20160816; b=CuxZK+G+3bP7cu96fMGxbB/lss5d2JDuIKiDmTB0xUwX1pYoXb0nRXszPGuU0yTtJ1 63+D+HMXy3rqTsCnD5GwvabFTDUpLuy43yiJJl0vPBk4cne4Z9zhoam5Zgip8DD6sOBG q3zjV/lPMqsTit2RQ0na7jJhwkkXrkA0E+6fv1SVN5I+CT66zZHjHzYWWOH0LT3gI1vW 9c17Dal238XggMmyZsRXC88UoskX8zm1I6DcHnsVhV/l94uuYBs7Ebirb/QMDdTSXnNg P6fXhxwpq0nDVGH5YBpvk04ZqJT0YO7e/QOm/NBxcrcITfTyC35IoqwRynp1nN/UYNw4 NP3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=xNOhVEGA1+wfkSw8lLpS1nHrin/VwWv41XiZwlbriU0=; fh=JGdrvN/w012dnbjKJ0JfB9VQZcMFPbKXDl1w1lOCUDw=; b=wOHvTncrQv52CKFNzPKG3XGWQ/eY3OtsSWYoY5izUjFnt29Jm3u9aKZIcr86NF3T6n mrhVYm0q0/8TTjU8CmjjuwShRhXVaIoSv2mmPX3ES8tTCEuXlpo1GOV4Z6KICuZ1z0d7 Nhar9ece0tv5gi1roWF3X1vZOl39cqtx1HzYYBrPLOU635IP5fi1d9C9BjvkJVmCFsHz LbzGgRou0AwzVFgy/s34b1NzMp+MSx/EJiAxLnyXQX8yZ0N4X9UwKovLNpCkNTZPLLr+ yncW7NpXvLVkIgOAWu0wz035HZmUxRpkGWulhkALhhucYkAaZvzjXEAz/+Xh5y/A2/0n D43w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XUTLamqS; dkim=pass header.i=@suse.com header.s=susede1 header.b=XUTLamqS; 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-43100-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43100-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b24-20020a170906039800b00a35da54db3csi645105eja.979.2024.01.29.08.33.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 08:33:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43100-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XUTLamqS; dkim=pass header.i=@suse.com header.s=susede1 header.b=XUTLamqS; 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-43100-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43100-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 626141F23C6C for ; Mon, 29 Jan 2024 16:33:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 17495157033; Mon, 29 Jan 2024 16:28:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="XUTLamqS"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="XUTLamqS" 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 5E8D2157035 for ; Mon, 29 Jan 2024 16:28:50 +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=1706545732; cv=none; b=ApGNeZufBwM7aPjEyqN4Y/vaWsU2yPQ1oEM4krr64lSnEIULFGDymRhN3wTDRZFRUuWUpQ9prjlO5Hzk/IuvxQE7ya4BDJA3x2PB5DcXls96oZVv3F/6hdJD9fIxF++dA1bf1iNUUOOL3Y67mmwulTektynASwyYr71P/O/NOMI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545732; c=relaxed/simple; bh=dLUua/FV/D+oSNf4wtskJdzGZLmArhy5mTtk5oBrNg0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=O47SyxYAqBRNIn2O6zB43k3NDt5WCAVu1pZWa3pdXcIfHNJ9Zawhi2xWsTkCK8NhAHZyD0B96MUnUnsfFhLZaVDusWzn4Iz9GnVjIaYk5he6nYfZFOzsOqLOMsUlUnmNASW+evSYwdJ9Bq1Cx+EYyOE9LrQc97/JF9AqC0xVp2Q= 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=XUTLamqS; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=XUTLamqS; 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 50EB322113; Mon, 29 Jan 2024 16:28:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706545728; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xNOhVEGA1+wfkSw8lLpS1nHrin/VwWv41XiZwlbriU0=; b=XUTLamqS6cd43HyhnadirfxcREIIdcSOwpPQRua7eYb0PQE6FwmmZFjot86SHgO4lr2i11 qkNTftHHazJjiCwG00CUWJ+G4hiywzyL5mq/aenxyeVDiiEOVLmcwqzU3eruhQKNUVYqMV 1SZy3nK9L/8NGIeJmwW4VTNi5A0IAjI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1706545728; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xNOhVEGA1+wfkSw8lLpS1nHrin/VwWv41XiZwlbriU0=; b=XUTLamqS6cd43HyhnadirfxcREIIdcSOwpPQRua7eYb0PQE6FwmmZFjot86SHgO4lr2i11 qkNTftHHazJjiCwG00CUWJ+G4hiywzyL5mq/aenxyeVDiiEOVLmcwqzU3eruhQKNUVYqMV 1SZy3nK9L/8NGIeJmwW4VTNi5A0IAjI= 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 2B30012FF7; Mon, 29 Jan 2024 16:28:48 +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 8lD2BkDSt2V0UwAAD6G6ig (envelope-from ); Mon, 29 Jan 2024 16:28:48 +0000 Date: Mon, 29 Jan 2024 17:28:47 +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=us-ascii Content-Disposition: inline In-Reply-To: <20240129054551.57728-1-ioworker0@gmail.com> Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -0.81 X-Spamd-Result: default: False [-0.81 / 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]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; 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.01)[50.99%] X-Spam-Flag: NO On Mon 29-01-24 13:45:51, Lance Yang wrote: > khugepaged scans the entire address space in the > background for each given mm, looking for > opportunities to merge sequences of basic pages > into huge pages. However, when an mm is inserted > to the mm_slots list, and the MMF_DISABLE_THP flag > is set later, this scanning process becomes > unnecessary for that mm and can be skipped to avoid > redundant operations, especially in scenarios with > a large address space. Is this a real problem? I thought that the prctl is called on the parent before fork/exec. Or are you aware of any applications which do call prctl late enough that the race would be actually observable? -- Michal Hocko SUSE Labs