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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63DAFC48BF8 for ; Thu, 22 Feb 2024 07:43:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B79F46B0071; Thu, 22 Feb 2024 02:43:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B03616B0072; Thu, 22 Feb 2024 02:43:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A3876B0074; Thu, 22 Feb 2024 02:43:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8683F6B0071 for ; Thu, 22 Feb 2024 02:43:34 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2BF1AA1137 for ; Thu, 22 Feb 2024 07:43:34 +0000 (UTC) X-FDA: 81818649948.07.C787ACE Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by imf09.hostedemail.com (Postfix) with ESMTP id 8AB09140008 for ; Thu, 22 Feb 2024 07:43:32 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AHKbR81L; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of ioworker0@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=ioworker0@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708587812; h=from:from:sender:reply-to:subject:subject: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:dkim-signature; bh=9sqllwmMdInDIe20Q1qFJaLb0vW0NHDiyKJEVgWyWzI=; b=WUBCboNZqAl89YHj5TKB1WvzTYXquyW3SnmS+OnhjXNBY4ujtm5Fua+2r93dxGApzJE6y6 7rr2HNbaP+hYFyOIeEqudUfEo8zikmEYVlFN5+0dg8mZpHNFDMwYKFXW9F6Ece55W69PI1 xxoZ3ErT84FopRmKS8P0qnutmRhA3Zc= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=AHKbR81L; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf09.hostedemail.com: domain of ioworker0@gmail.com designates 209.85.219.182 as permitted sender) smtp.mailfrom=ioworker0@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708587812; a=rsa-sha256; cv=none; b=PDwlljuhElyi8/4Xn9w7Ir9whja+wphHRTpSDeFmf4xq44RqAvMWu1onCTkW6p6hGl3uTU XMcWJwLFNRqh95B604K1V0fBhqo0iVoJt9WOzoNWR7tGyK8H/zxAHy8JHmG96s2I02XZC7 UvCxD5K3HetieUy1PUpb7z/sMEyAfqM= Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-dc742543119so6360510276.0 for ; Wed, 21 Feb 2024 23:43:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708587811; x=1709192611; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9sqllwmMdInDIe20Q1qFJaLb0vW0NHDiyKJEVgWyWzI=; b=AHKbR81LZ2eLenf4Qu1J8hCkR93o4+giH5h6ymw0rWzU+R/ZrNafYOeTjOZ+Z5+Fv1 lMl94cT2kOmfFXhy8taT5KMl2ozV3RwO+pCtgs94wqB3Yq6TwNXXFuH/VCejLsdEQ3Nk VLmSthan4ZfXPrxGHmAIl7JHWydNUR2YD4Qz6/vLYbz/+r/1PMJkzpy776tHj8hODjvp RHvCbNKFoqIFTBqwMvbtCqCnb1+eZPVPgvJkFM8CMCklVZmqkxzvpzQ7APyDtIV0Ss1l mQIQW0XxMzyBwtE+L/SZYNlGuef9GEcRDIm0RV3aU6WrbaBLE/kVFotSRBoF11WUV6G0 A0bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708587811; x=1709192611; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9sqllwmMdInDIe20Q1qFJaLb0vW0NHDiyKJEVgWyWzI=; b=rjXVtw4x3pcie9c0+dWoZEx8xFafeH6huEOjyEDJh88QfzvxCJvwVpEIRVFpxqHhJp 7CyzLYaK3qbd+Rs1708FgXwX1hGkJuQMYDBD6FVmqAeOOCZ9ylWDYdpBdJZEWd/SOcio g7qv7pS2bsWm9KCt8Nuzun5Iguh8syGxTn2JMgBFaqJFUGvIMf+QshQTq5qO8fgMhNrH VSCT/ztxFdm40u//aWojLGf3+ihZO+7UtuWKCuO/bg4oKDZGVlWwj2sx1oux6PJN6NKv C25Xab+NsHOlMjAj2WjSbtnLBZuli4QkLlpk8uKz6EZnBwumCIAtf4FP+nkvls7RTXzM 8l7w== X-Forwarded-Encrypted: i=1; AJvYcCVBSvu3tmtDXhJcZINIMcevmLdtkaRcSbjVy5QhuWOCiKsqYHxAKl4sR0QCnWczT8w3mwRYLUHlLVSxivXb0S8cSR0= X-Gm-Message-State: AOJu0Yzp3z6hLZlGoL4Wy3vyeUwqqcctb85ABP1fCzlWImvRTVLdcQzD WX1bkpHWi++3+WBiNOzubnYGBz9SkAZp/DTPUvSYZ45ua269P1U/cOKKosqfiGA5SN8xxhoL4sw ZNhjH70jnRZgG612nfrsK7pUgfrc= X-Google-Smtp-Source: AGHT+IEB0Sxyp4bTrLUSmzOTVsMvWTpbFwxuWDCni7OCfr7nYgHwikgibD0wz2CAwJQN6UvT6AdsIy9nKQ7TBPgR95o= X-Received: by 2002:a0d:df45:0:b0:607:925a:3bfe with SMTP id i66-20020a0ddf45000000b00607925a3bfemr275058ywe.24.1708587811596; Wed, 21 Feb 2024 23:43:31 -0800 (PST) MIME-Version: 1.0 References: <20240129054551.57728-1-ioworker0@gmail.com> <20240221141158.8217ff2caf4f86c11a430058@linux-foundation.org> In-Reply-To: <20240221141158.8217ff2caf4f86c11a430058@linux-foundation.org> From: Lance Yang Date: Thu, 22 Feb 2024 15:43:20 +0800 Message-ID: Subject: Re: [PATCH 1/1] mm/khugepaged: bypassing unnecessary scans with MMF_DISABLE_THP check To: Andrew Morton Cc: mhocko@suse.com, 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 8AB09140008 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: e9icxwumbs7p568hxp84wx9ue6wc44wp X-HE-Tag: 1708587812-154770 X-HE-Meta: U2FsdGVkX1+hwSxCdXm4syjxiZgt/OtsDBeFK39mjIfranHHKFZoj+OlN+6HNV53XwkOkYFCZOigxFDajrrYxRjhxj+43DMFY5KnN3bj9TFJfkPYiCXim16UBhoi5IcbtxhhWX21ccW2W6fdoZTWft6IKB5UFBt/ITenuWIlHHEyz6+y+CIEF6qrjJH+PRZ9BVOj6aE53B9m6mEAQIatH026xgt5s66JxjA/Ul/wLfdeG+q1eA3iAaN7Fm6dqtphN3HvvrcauYZOqpV53jKwOSNHwVVWqSPgmYMP060OETqt3mGIrk1lX0nUxKewOxkpBYNghtS8xP16JVPnPFyG7OlbPzFZBf0aif/2KEKNZYRhHAGbtbkRciUSFdDfA/PgMJ7mRRW1NduFUt/KHM0YwC/1fZbP24UTeD5TZXe9Qx2910wedD5cfWHqs6qVm5lu/B4PMlJs6wGXL/yOF7hxYdRWzg32pHQiQYz430DQ+9dIEp/BshVJQ0jf+oJi5dipifaJlkcwCLCcwUdGec1fpY/2rySvGhOJkXz5sA2V2IFKlt35sVfOTaotoIdtXKL/hxPd7m7KqEH7yIazDUm+IRcxMo1WIct9eeBw9BgKf3K3oDLp4cHwGnzdfCk9ViRAJFUZe9tuQ/Wb5JR7UiLOicfhxKEP+IOwb1jURI90uteeJIGWH3k9dFcry0Tv4fYgM/L2bcEmPdj5k6ivi+CnVPXQwud9rKebe/UfFcFxI3uDCKaBGx4T7GChgAIZHVMVQMVhb0+OqaynxaddaPHn4r5YIZX1iT2qxP3FbNbqGGUHY/JTmODQIn4NXyJM2Ml1FYkmM1Hz+o7DHt4Ng2s+CluMMufa1Vxn4GppYCdNSYCS6Nksr9ejFlbKd4yYVJus/mMKEpWfwLsQaw09OKWiiS/TawIA3HsTA/uY8cb4uBVShRT91OfzAUUDho89UpZl43we17SVB9LPbYkdLf7 1rzwAhsI XX0zATFy5jdedVcVaqFMS1jpQONDG5ZOfZFrDQS1kl6b6SF4HkzlNPv+teFqGcLo7KY5KbnrXbOkK1LO+VTYPWa3/5g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.029579, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hey Andrew, Thanks for taking time to review! I appreciate your suggestion and will be supplementing with test results shortly. Best, Lance On Thu, Feb 22, 2024 at 6:12=E2=80=AFAM Andrew Morton wrote: > > On Wed, 31 Jan 2024 17:30:11 +0800 Lance Yang wrote= : > > > Updating the change log. > > > > 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. > > > > This commit introduces a check before each scanning > > process to test the MMF_DISABLE_THP flag for the > > given mm; if the flag is set, the scanning process is > > bypassed, thereby improving the efficiency of khugepaged. > > > > This optimization is not a correctness issue but rather an > > enhancement to save expensive checks on each VMA > > when userspace cannot prctl itself before spawning > > into the new process. > > > > 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. > > I pasted the above into the v1 patch's changelog. > > However I'm not seeing a good level of reviewer enthusiasm. Pertially > because of the lack of quantitative testing results. Is is possible to > generate such results, to give people an overall feel of the > desirability of this change? >