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 9F1FCC282DE for ; Mon, 10 Mar 2025 15:57:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65476280005; Mon, 10 Mar 2025 11:57:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6025B280004; Mon, 10 Mar 2025 11:57:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47D83280005; Mon, 10 Mar 2025 11:57:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 042FF280004 for ; Mon, 10 Mar 2025 11:57:12 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9582A1CB576 for ; Mon, 10 Mar 2025 15:57:12 +0000 (UTC) X-FDA: 83206095504.07.D320997 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf29.hostedemail.com (Postfix) with ESMTP id D4ED712001C for ; Mon, 10 Mar 2025 15:57:09 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jMKyXEam; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of gmonaco@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=gmonaco@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741622230; 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=YIEFTn4o/Wiywn2P5BXfgmgT1qd2QuZ4tLJW8Pp9+uk=; b=CuWiA49wtSkAKCU0sl32uWgBEOD6ZCQfykVUf2mGDYVbEDaoDJNxTIjcy+pCj6SvlbMzsG VmC2hDZy+1f+1qgVxRhXbFdZJcBu937dfaLJ9uaY8IGBUE9S2VjAIYn00N36mt7Athe7rf 3jd6SKuoWsKoLfkdJh65l0OBWNaDwzw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741622230; a=rsa-sha256; cv=none; b=Fw2Ka/cjbHL84SoQ4efO3PG+rgSiqcWvMnFl6EurzrGqPmAbuiy/jza3SuRsHYdUeOjRBO 5sz7c/Si06/HNBmA6NKStfVAfaklWZDIlHGrjDgYtlt+jlKy/MtkhDsfA+Ei5CTWWwjgHk viNMQXUe9q7IVGTnxytgCbFq0+vgFFE= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jMKyXEam; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of gmonaco@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=gmonaco@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741622228; h=from:from: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:autocrypt:autocrypt; bh=YIEFTn4o/Wiywn2P5BXfgmgT1qd2QuZ4tLJW8Pp9+uk=; b=jMKyXEamc+USYeRSaOXDR/AcFRHKnY7WrbQrHbLyRHwVo3+ffkGl3AjIw4YKoSNk8iV8mn 3YIEHF1Qv4FX2JgzEAKs7DA0MzVFknGrrRl9rpCJIs/ucwsB77MWFGIdx3znZzD4zefwNg /u2eEytsmDvvuC27pviROM1fm2bZgp8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-LU7yJJSTOvOt632T0TAtQQ-1; Mon, 10 Mar 2025 11:57:07 -0400 X-MC-Unique: LU7yJJSTOvOt632T0TAtQQ-1 X-Mimecast-MFC-AGG-ID: LU7yJJSTOvOt632T0TAtQQ_1741622226 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43cf446681cso6549965e9.1 for ; Mon, 10 Mar 2025 08:57:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741622226; x=1742227026; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YIEFTn4o/Wiywn2P5BXfgmgT1qd2QuZ4tLJW8Pp9+uk=; b=XiT+OFBtxU1mrC2F3OOeGr2rsN9DYkCREHe2BVUpJvtmqgFJN6OwK9yF19El6R18Wu YePh/TWkBj2IEHLEAMhJKcsoTuCMbp8kJCISZ4PZTu4JfqyNf9hRumq9/r6CQZbNdHum SkAiyKtfM5UejO/+AtwwihTNJ3Vpd+sMLszLwCbxcB8IMtvs5rMCh5eZJs/rOazC82K8 JvtsVb4qsHdamuAsL5vVX/L+ngrIyHZQUh9adOy0SZqeGg+fVb6x/XEnT8MnEqvHs1qW dz2nEvZ8lpZZtdBcIjCYaSoKUlurejhNfZnqiLdxhS6+c05tojLfMEJlM4G/Gmw8AMAN 2sjQ== X-Forwarded-Encrypted: i=1; AJvYcCUMGh1kNRp472G/ZM+THHkFbnn5uLX73TrMLEEKF79s2ebkgwa4+vVQS4dzzISGml552oxLSv8O/g==@kvack.org X-Gm-Message-State: AOJu0Yz5/x216dXkWdQnPt+kh+mP2iWD0v6KPKjmjWrqDyGk8E1UGWVp Uv/J+6PrzKGStrNGp3KnKHbhsRw8sWJpV1VzM5Fxd+VYeq1DpzLcrokJtuOdkZ3P92fxfguOjyA 5NQOPw1IQ/p59lzInFiuo/NLx1CJJv3C6Frpep4LiZdTOEPkv X-Gm-Gg: ASbGncu/fYuER+MPK4AIF62FDrg3E0Sy/QHyHwW8zke49GhidE/kSS5KXjdPNaAsiRX 81GCgSfk9jRzQk4CDY9kNLEUMaoYgRd9qYIDihB6KkMEd/fmOxxMb7zflADCBRiLxZ7LAw98jdK Het4o9fCBqORlYWEGki8lGzZDsmpOY/9BuUrJshFnn2GIi31tD2NxDSnHpqh430izaY5ZVJRryh A8LGJiOEZbiqyK1AJGFlqOsPEVVryRfHITRPZumfhLL2IvsC0PbPhTVMxPIVR37A5F7nSnehSAA ZYvxUvXFQNrKvkQw276KIC3VYibQK5yjTS7yboyduw== X-Received: by 2002:a05:600c:1c9d:b0:439:86fb:7340 with SMTP id 5b1f17b1804b1-43c601d19cbmr100841255e9.30.1741622226499; Mon, 10 Mar 2025 08:57:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7Wx729XLbdYNhh5Uh5+ULsnmrD5hmJxoj3oRgjANDXFizew90DDJwcouqQiqEKExMdX97wg== X-Received: by 2002:a05:600c:1c9d:b0:439:86fb:7340 with SMTP id 5b1f17b1804b1-43c601d19cbmr100840845e9.30.1741622226066; Mon, 10 Mar 2025 08:57:06 -0700 (PDT) Received: from gmonaco-thinkpadt14gen3.rmtit.csb ([185.107.56.42]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43cf8a840e1sm37754895e9.8.2025.03.10.08.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 08:57:05 -0700 (PDT) Message-ID: Subject: Re: [PATCH v11 2/3] sched: Move task_mm_cid_work to mm work_struct From: Gabriele Monaco To: Mathieu Desnoyers Cc: Ingo Molnar , Shuah Khan , linux-kernel@vger.kernel.org, Andrew Morton , Ingo Molnar , Peter Zijlstra , "Paul E. McKenney" , linux-mm@kvack.org Date: Mon, 10 Mar 2025 16:57:02 +0100 In-Reply-To: <31fa089d-1f55-4bc7-9323-389fda4cadfa@efficios.com> References: <20250227153329.672079-1-gmonaco@redhat.com> <20250227153329.672079-3-gmonaco@redhat.com> <1c161066bcbc916ae9d97e7d1753ee12511da085.camel@redhat.com> <31fa089d-1f55-4bc7-9323-389fda4cadfa@efficios.com> Autocrypt: addr=gmonaco@redhat.com; prefer-encrypt=mutual; keydata=mDMEZuK5YxYJKwYBBAHaRw8BAQdAmJ3dM9Sz6/Hodu33Qrf8QH2bNeNbOikqYtxWFLVm0 1a0JEdhYnJpZWxlIE1vbmFjbyA8Z21vbmFjb0ByZWRoYXQuY29tPoiZBBMWCgBBFiEEysoR+AuB3R Zwp6j270psSVh4TfIFAmbiuWMCGwMFCQWjmoAFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgk Q70psSVh4TfJzZgD/TXjnqCyqaZH/Y2w+YVbvm93WX2eqBqiVZ6VEjTuGNs8A/iPrKbzdWC7AicnK xyhmqeUWOzFx5P43S1E1dhsrLWgP User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Q1PBPv9cn8UZvTszBB3JKKct-RKGy2lQTJanhj8Qycg_1741622226 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: D4ED712001C X-Rspamd-Server: rspam08 X-Stat-Signature: 4mufsfdzn1ipbqi4g8dzmkiq97nx9qas X-HE-Tag: 1741622229-826370 X-HE-Meta: U2FsdGVkX186Ab1zY4G4TKS+NZ3ATawQUuclpp0uNkfpleK4WoGDkWGN9XX8qpgr9Qq/G2ar351aqu945RCS20H0OVXRUx3quxhpxMfsWsjBE8orvTBp1meCuq0UV4ndzOscMHW/vl9ArlX6XD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ObQS3b+jAYWUXXRDLQXlqssTwC03abF+TDV2DBCuOFwtaiexZRUeBAhW1L+qEoUFpFLS3yrixax6gemoYB8K5IY8YZ4AXJS/aHIu9C8EYS5GJAgDLhTJokU2tVEA5P3I9QMywEgSdbC6ZN33pXl9V8z6xIt3Z7WI7ElEQ+/MXH4ybJwKTJAMH8Tk25zzBdL X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, 2025-03-10 at 11:50 -0400, Mathieu Desnoyers wrote: > On 2025-03-10 10:46, Gabriele Monaco wrote: > > On Thu, 2025-02-27 at 16:33 +0100, Gabriele Monaco wrote: > > > Currently, the task_mm_cid_work function is called in a task work > > > triggered by a scheduler tick to frequently compact the mm_cids > > > of > > > each > > > process. This can delay the execution of the corresponding thread > > > for > > > the entire duration of the function, negatively affecting the > > > response > > > in case of real time tasks. In practice, we observe > > > task_mm_cid_work > > > increasing the latency of 30-35us on a 128 cores system, this > > > order > > > of > > > magnitude is meaningful under PREEMPT_RT. > > >=20 > > > Run the task_mm_cid_work in a new work_struct connected to the > > > mm_struct rather than in the task context before returning to > > > userspace. > > >=20 > > > This work_struct is initialised with the mm and disabled before > > > freeing > > > it. The queuing of the work happens while returning to userspace > > > in > > > __rseq_handle_notify_resume, maintaining the checks to avoid > > > running > > > more frequently than MM_CID_SCAN_DELAY. > > > To make sure this happens predictably also on long running tasks, > > > we > > > trigger a call to __rseq_handle_notify_resume also from the > > > scheduler > > > tick if the runtime exceeded a 100ms threshold. > > > [...] > > >=20 > > > Fixes: 223baf9d17f2 ("sched: Fix performance regression > > > introduced by > > > mm_cid") > > > Signed-off-by: Gabriele Monaco > >=20 > > Is this patch missing anything? > >=20 > > I refactored a bit to have it build in configurations without RSEQ > > and/or MM_CID (which was failing v10) >=20 > Found a small nit. Please fix and resend with my reviewed-by, and > that version will be ready for inclusion. Perfect, thank you! I'm changing that jiffies thing, testing a bit and sending it. Gabriele