Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2125679rbb; Tue, 27 Feb 2024 11:21:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVmIwFNrewU/6VB229rH55IRzcECb/g/cNueDOGm0hhkWyE3O1qr1+LIsdStH0tr5RN94rNZ1hm4TH84KKYIdgF960iUc12k1bzMCM9OQ== X-Google-Smtp-Source: AGHT+IEfuwDPZrZgOEoi/ajvTg20s/giZr6cCSY7vmUBvpEm+WV29MXfT++Bmv8vX+ZaOKqj8C2J X-Received: by 2002:a17:902:6803:b0:1dc:b531:839 with SMTP id h3-20020a170902680300b001dcb5310839mr3333377plk.25.1709061718116; Tue, 27 Feb 2024 11:21:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709061718; cv=pass; d=google.com; s=arc-20160816; b=iq6iL0Ns8rjq4PR2Z3pVVRRYgKm9Ikv442gWDzkDIrHivbHdarHJbg/8y7ZsiDeU+w yE98dZXqh3vQwB83sFXWJ6yOp9IcvCDfrjEpyzjdNl/jzRCKfEdqQrz1oHgMGFG7iVDj cnlnEr8v69jLF/gvFEx3hQF/TNzp+MYomr421d/Yygi10HFJ1JTGQOYQesfzDdC3hBLF 0EEKDeROxnAEqks1fxRt5GvWXGbvhNhXc8CQ8/Y4P7F4X0KN7VmL+038dZoN+2GyFnum crqPwH7Ovd//8YEfFdCqpCyrxE8tQauS2BzfBh0LwJLPfp7SOzaDvSYiPi2SUS9neFGi EbzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=iBJKbsd4wIdKds37USwOrWAAhA255FzoeAt9UUCRGXc=; fh=napPNEIgHhaD23n6cVZhmv13RiRv3B7+8E32M8lwJm0=; b=TVatz7RnFq1wTsOM+Dj9E1+sKl8ygUBm48Z1Qq7qWNsUbDOcumMQtkNLymqtcK87rx TC0N9nOcsKuaFQZZAQGDVL8+j2hFrtbsmbLkoPv2byMnZCUxvB9n/5Ia2FkSo0/1Muca GnZMSFLHYw80eJaf4jY0NDQWDQB0DujTQ2i/as/rpg6Cu/sAilYSfuYTh7tJP4lnE1SS coOX5ehPYwmN8ryJaHRIbLR1uofr3/Y8wEwWLZr0i4i1UyGVBGLKpOoMpArEN+njleEF hkgkyu4qNHFzImaTJF+Zw8v+NqlyDp+Trzg6Lk0OqgMyyMaeDKHpx1f+l3o8qW4fH+rs ypjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UNW9S+fS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83903-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y8-20020a17090264c800b001dcb3448845si1763232pli.557.2024.02.27.11.21.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 11:21:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83903-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UNW9S+fS; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83903-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id BCB43292783 for ; Tue, 27 Feb 2024 19:13:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A177351C36; Tue, 27 Feb 2024 19:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UNW9S+fS" Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 6FF5052F75 for ; Tue, 27 Feb 2024 19:13:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709061213; cv=none; b=RMZ3tSh6I3/leHcwoyshdfBMUe3i0fs36w/Qywaw9pWanqudW9XbxfhbOmtN9fgoQaRRvOUlJGbpOqVPItOrqGtmI1DRl0Q0qoW+YhDw92+BLo8nLbTzQC2IqgfonPe2B4Hp6z6VLEYYKwesarsMVYXziea2XBYDS8srkW0o8Qg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709061213; c=relaxed/simple; bh=LBkRRri5lOqofO6BZrkIFyBWNzE92eGEiK2jzbe8HAI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=r4BvXbXO7YsPcgDHQyu3lsr6DJlpFqiVS7bhzQjEuxD3g0xgVEap5VN0KxKlBL31hyAvDp+pNaDjPJvgakTnDYXgrks5f4DL+9pZxbUyvaF+yIJv0ZBuEHrmfn5lzkKsK7noadpmgpcQpZrdh2IIHi34xnD4krAS30Pt+xALjoc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UNW9S+fS; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-5d8ddbac4fbso3886559a12.0 for ; Tue, 27 Feb 2024 11:13:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709061212; x=1709666012; darn=vger.kernel.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=iBJKbsd4wIdKds37USwOrWAAhA255FzoeAt9UUCRGXc=; b=UNW9S+fSUscU5vhGyOB3w8zCNC8p4rdLsK+P93y7DAYtpTSpWco3bdyde6ZJREM2Zs C3Ru2s3iJtzVH6xylJeRK7lyoMMRGWqEvf6Q8WnUmpwAaL9bpsUmjLREBKxVzSYuIXt0 svj+J1KtYwlXQl8KZAkFrfsf1l0LwHbGblac3EFia6E15+VGcKll842AZ4MVg84Xz/R7 ryMNmgtISiU1xupQbFja2TcJw8M6PynJ4GE+9hWagT0HKlh/LN7DxSbxDThZZTNXntWO RWRmu5jpj7aMjGnFsGdlcs4nyTcdOAha51E4sFaWE7yVIJjF+wqWIsQd9fbTdEYVerm2 ZV4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709061212; x=1709666012; 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=iBJKbsd4wIdKds37USwOrWAAhA255FzoeAt9UUCRGXc=; b=smclCryUZpGW0XA3bYTcKhkgKBTtJ8SkGT6ME+gtTdT54d4nbi51arqXJzdbLnBh8p 4FhXT+0K3K7/vk5DpzYn0jDoC/xNJ/IB3JyNcEHLgpRP06aTCjYqyJ1lwVR7+W21sV4j Bp5A3ztLsEj8DVE+emdtvdTu4E9kdzzxxf9n3HYI7MmqD/vnWmHHcbfa9vNQ3KK4OUZa z2Z1g0WOO2whJlc7A0ROqAEj19bkp0aYG7kAvLSWFSXcdHhDc2cft9LEIIlTSSksXnfU BeWaAZb8jMgBenn6TGbMIKNSkHwW+1JhIwUzcOKJRkFV9roVHTTocE+fj367DQ3tOBtD LJMw== X-Forwarded-Encrypted: i=1; AJvYcCXD7hnrDPVDf9nwjWDc96jFEqVlF2NvGhr+xqQXaDQ/ziOTVNroa0PoQhSY8hHeN3nnoA3ZcLE8nlXgwaWCGFJ9HRHi6TDcjEijIndZ X-Gm-Message-State: AOJu0YxmWYedlLMSjC4+ERKyfR2w9VE/gNnqM8zJGQIPFKRwHq2uiUaU xvn+wXN41q+SvRNpM4JtP2yUKxZiP5G3eD9yspZ1MUmYnQMbpRma6uR9/Tw5TG9R3wobOzNiNPY 3E1wEdQFAur/Ef69TnwI4kN22bkE= X-Received: by 2002:a17:90a:bf0a:b0:29a:68ad:b77e with SMTP id c10-20020a17090abf0a00b0029a68adb77emr8525394pjs.19.1709061211735; Tue, 27 Feb 2024 11:13:31 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240227035135.54593-1-ioworker0@gmail.com> In-Reply-To: <20240227035135.54593-1-ioworker0@gmail.com> From: Yang Shi Date: Tue, 27 Feb 2024 11:13:19 -0800 Message-ID: Subject: Re: [PATCH 1/1] mm/khugepaged: keep mm in mm_slot without MMF_DISABLE_THP check To: Lance Yang Cc: akpm@linux-foundation.org, mhocko@suse.com, zokeefe@google.com, david@redhat.com, songmuchun@bytedance.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 On Mon, Feb 26, 2024 at 7:51=E2=80=AFPM Lance Yang wr= ote: > > Previously, we removed the mm from mm_slot and dropped mm_count > if the MMF_THP_DISABLE flag was set. However, we didn't re-add > the mm back after clearing the MMF_THP_DISABLE flag. Additionally, > We add a check for the MMF_THP_DISABLE flag in hugepage_vma_revalidate(). > > Fixes: 879c6000e191 ("mm/khugepaged: bypassing unnecessary scans with MMF= _DISABLE_THP check") I think Andrew will fold this fix into your original patch. > > Signed-off-by: Lance Yang > Suggested-by: Yang Shi Reviewed-by: Yang Shi > --- > mm/khugepaged.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 2771fc043b3b..1c0073daad82 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -920,7 +920,7 @@ static int hugepage_vma_revalidate(struct mm_struct *= mm, unsigned long address, > { > struct vm_area_struct *vma; > > - if (unlikely(hpage_collapse_test_exit(mm))) > + if (unlikely(hpage_collapse_test_exit_or_disable(mm))) > return SCAN_ANY_PROCESS; > > *vmap =3D vma =3D find_vma(mm, address); > @@ -1428,7 +1428,7 @@ static void collect_mm_slot(struct khugepaged_mm_sl= ot *mm_slot) > > lockdep_assert_held(&khugepaged_mm_lock); > > - if (hpage_collapse_test_exit_or_disable(mm)) { > + if (hpage_collapse_test_exit(mm)) { > /* free mm_slot */ > hash_del(&slot->hash); > list_del(&slot->mm_node); > @@ -2456,7 +2456,7 @@ static unsigned int khugepaged_scan_mm_slot(unsigne= d int pages, int *result, > * Release the current mm_slot if this mm is about to die, or > * if we scanned all vmas of this mm. > */ > - if (hpage_collapse_test_exit_or_disable(mm) || !vma) { > + if (hpage_collapse_test_exit(mm) || !vma) { > /* > * Make sure that if mm_users is reaching zero while > * khugepaged runs here, khugepaged_exit will find > -- > 2.33.1 >