Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1478327pxb; Fri, 10 Sep 2021 06:53:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysh0CO8vMoMtnyRVIjhBvaRmShUTFL9jAmWIsXGLIT1zhlflJ/QM6EGjanyAGJEbLR/4/X X-Received: by 2002:a05:6402:5250:: with SMTP id t16mr1906572edd.227.1631282021051; Fri, 10 Sep 2021 06:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631282021; cv=none; d=google.com; s=arc-20160816; b=JGiq0GjoY1asSf4xs8tjJc0LHsbVzXHMa/P/rNnM14fP1R4oyuYAElkHzjNixLYkqE UIo2QwbaaUZVxDKOLHfa11T/SDS+tpPbMGPmTt1AifPFUJKJ1JiMPaNLtNbVAOLIJKCm WwWVp75lt1s+Lj+5EIQT8YFxbRd3kg/m8BSqzPQ/p2WuZQ6e6zN9qDFrLcmTqhcD5bER fHQcELrkDTNmqw0tdcHOSeR0G/0Ye2s712HBOXbzPG07OgG5r8cy26RoISRtgf4ebptQ h47z8P2dU+Q1YkvTAFKatGhCOSt6c1VKT1KHDbe0q0DKN/+aPohaiaKebdyQilFgA9Io lZyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=rZ7wX9gnYVZ+IUhQNGX1+3fKK1+B4n+d3hgqCAR8Nrk=; b=UtKYpX4qiyMF0CktuikAORbPVq0X+MoVumFWDpSpiS6wuW8oXz7ZNUFgXrGzgCdhGc aiKg0x+wCEIU1MafvTceDND9V2dX6V6bJCCkbQlG8Z368OQYv5PM8MvIA3NY/DVIJ8ab KJNVrlmeEPBBjLT8RGFeItduf4kTc0azCnLylYOOo3PExBGfUFSiAawvzJM6kfZJhgYS AUvM63fvvAhlXnctYszcBZEBrj2Eqt5f7g3v+8QADHDp3vZLm5KgPS2ql3qP5sIxcQ/L jHKfMaIYp1te6ZUUksP2IP/0YQdJAPjPovKCuoNMDUoBBYaAhq9BBx5/9qfcgrPNc0np KwrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KJILneJ1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si4985888eds.504.2021.09.10.06.53.16; Fri, 10 Sep 2021 06:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KJILneJ1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233682AbhIJNvA (ORCPT + 99 others); Fri, 10 Sep 2021 09:51:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31731 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233245AbhIJNu5 (ORCPT ); Fri, 10 Sep 2021 09:50:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631281786; 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; bh=rZ7wX9gnYVZ+IUhQNGX1+3fKK1+B4n+d3hgqCAR8Nrk=; b=KJILneJ1Deep3lpEP/v8RXsdwPYvtMklQV/jmcBi67kZMqwI2JqdOwQ67ucHbocj9UpIIl Bb5kNOiduhVxmNOkK/I0V5WbYcKav6biUa6WFeefT13o4q45uj7xZ8zWEjxuWqTh/XYsYT z8eU5rrOSHZFudSKjePDe6Sdatr0vxM= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-175-Zua19QLbOI-HTgXAwuD2fg-1; Fri, 10 Sep 2021 09:49:44 -0400 X-MC-Unique: Zua19QLbOI-HTgXAwuD2fg-1 Received: by mail-wm1-f72.google.com with SMTP id k5-20020a7bc3050000b02901e081f69d80so853409wmj.8 for ; Fri, 10 Sep 2021 06:49:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=rZ7wX9gnYVZ+IUhQNGX1+3fKK1+B4n+d3hgqCAR8Nrk=; b=BYzarJncZFzkC4c7K03cEqQZrTeAaVTxkr7iCgCeyYp9LA90fpyUPmRpKFQ8PSvXE3 41tzAr07qU824ERGW28KwP7iEBxXh1YoV8vx2tRJm+0QB0znmd472nvKPjmDo2h01hn1 GA4wbpjXrCp+6V16Dp3goEhjMrSCyWdZnvC8AM1Nrcj2yz27eaQagzRBJ4/I6mKByPmI UkIWhld/l6iIiDKTR/ZjcZQ62F0ZVnhN00VI+hQ6uTlUBw6LDLL1sIC/aic/oKv04i1O CCcbh7gtddrB55INs87DOazLKG28Myr3+QH1GeeInF729vVdFjxL4buveD9XapknAjOA rMSw== X-Gm-Message-State: AOAM533RAOAn0tJLGHzRy7SO7hay/2hwAq1uyR4FNsefi4+o+pSb7Dzd 4PyOnWbe8iwMgBL95kQp6FpzqbGJGvPQbq3Yi+G9jBpxf9vAQV0vBpfCu3VmRlI6vuyQZKHUspP rmK9s7mix3he48M1vGyatSiUA X-Received: by 2002:a1c:4c13:: with SMTP id z19mr8479932wmf.154.1631281783618; Fri, 10 Sep 2021 06:49:43 -0700 (PDT) X-Received: by 2002:a1c:4c13:: with SMTP id z19mr8479917wmf.154.1631281783450; Fri, 10 Sep 2021 06:49:43 -0700 (PDT) Received: from ?IPv6:2a0c:5a80:1f0d:6700:7eb9:ffb3:3868:81d7? ([2a0c:5a80:1f0d:6700:7eb9:ffb3:3868:81d7]) by smtp.gmail.com with ESMTPSA id q128sm5180452wma.27.2021.09.10.06.49.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Sep 2021 06:49:43 -0700 (PDT) Message-ID: <92252a92c5fe45b3ef6d2627975d917e0e522e8f.camel@redhat.com> Subject: Re: [patch V3 3/8] task isolation: sync vmstats on return to userspace From: nsaenzju@redhat.com To: Marcelo Tosatti , linux-kernel@vger.kernel.org Cc: Nitesh Lal , Frederic Weisbecker , Christoph Lameter , Juri Lelli , Peter Zijlstra , Alex Belits , Peter Xu Date: Fri, 10 Sep 2021 15:49:42 +0200 In-Reply-To: <20210824152646.743604666@fuller.cnet> References: <20210824152423.300346181@fuller.cnet> <20210824152646.743604666@fuller.cnet> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marcelo, On Tue, 2021-08-24 at 12:24 -0300, Marcelo Tosatti wrote: > The logic to disable vmstat worker thread, when entering > nohz full, does not cover all scenarios. For example, it is possible > for the following to happen: > > 1) enter nohz_full, which calls refresh_cpu_vm_stats, syncing the stats. > 2) app runs mlock, which increases counters for mlock'ed pages. > 3) start -RT loop > > Since refresh_cpu_vm_stats from nohz_full logic can happen _before_ > the mlock, vmstat shepherd can restart vmstat worker thread on > the CPU in question. > > To fix this, use the task isolation prctl interface to quiesce > deferred actions when returning to userspace. > > Signed-off-by: Marcelo Tosatti > > --- [...] > Index: linux-2.6/kernel/entry/common.c > =================================================================== > --- linux-2.6.orig/kernel/entry/common.c > +++ linux-2.6/kernel/entry/common.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > > #include "common.h" > > @@ -287,6 +288,7 @@ static void syscall_exit_to_user_mode_pr > static __always_inline void __syscall_exit_to_user_mode_work(struct pt_regs *regs) > { > syscall_exit_to_user_mode_prepare(regs); > + isolation_exit_to_user_mode_prepare(); Are safe from migration at this stage? -- Nicolás Sáenz