From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Gabriele Monaco <gmonaco@redhat.com>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
linux-mm@kvack.org
Cc: Ingo Molnar <mingo@redhat.org>, Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH v9 2/3] sched: Move task_mm_cid_work to mm work_struct
Date: Mon, 24 Feb 2025 15:50:17 -0500 [thread overview]
Message-ID: <2bc76f69-901c-4d2c-bd75-64e757ec2230@efficios.com> (raw)
In-Reply-To: <20250224132836.383041-3-gmonaco@redhat.com>
On 2025-02-24 08:28, Gabriele Monaco wrote:
[...]
> diff --git a/kernel/rseq.c b/kernel/rseq.c
> index 2cb16091ec0ae..936863fe7eb37 100644
> --- a/kernel/rseq.c
> +++ b/kernel/rseq.c
> @@ -419,6 +419,7 @@ void __rseq_handle_notify_resume(struct ksignal *ksig, struct pt_regs *regs)
> }
> if (unlikely(rseq_update_cpu_node_id(t)))
> goto error;
> + task_queue_mm_cid(t);
Given that task_queue_mm_cid() will be called quite frequently from
__rseq_handle_notify_resume, perhaps it would be best to move at least
the portion responsible for checks (including the time_before()) to
include/linux/sched.h to eliminate a function call from the fast path.
> return;
>
> error:
[...]
> -void task_tick_mm_cid(struct rq *rq, struct task_struct *curr)
> +void task_queue_mm_cid(struct task_struct *curr)
> {
> - struct callback_head *work = &curr->cid_work;
> + struct work_struct *work = &curr->mm->cid_work;
> unsigned long now = jiffies;
>
> - if (!curr->mm || (curr->flags & (PF_EXITING | PF_KTHREAD)) ||
> - work->next != work)
> + if (!curr->mm || (curr->flags & (PF_EXITING | PF_KTHREAD)))
> return;
> if (time_before(now, READ_ONCE(curr->mm->mm_cid_next_scan)))
> return;
>
> - /* No page allocation under rq lock */
> - task_work_add(curr, work, TWA_RESUME);
> + /* Ensure the mm exists when we run. */
> + mmgrab(curr->mm);
> + queue_work(system_unbound_wq, work);
> }
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
next prev parent reply other threads:[~2025-02-24 20:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250224132836.383041-1-gmonaco@redhat.com>
2025-02-24 13:28 ` Gabriele Monaco
2025-02-24 20:50 ` Mathieu Desnoyers [this message]
2025-02-25 7:05 ` Gabriele Monaco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2bc76f69-901c-4d2c-bd75-64e757ec2230@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=akpm@linux-foundation.org \
--cc=gmonaco@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=mingo@redhat.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox