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 X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37BFEC07E99 for ; Fri, 9 Jul 2021 18:09:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 100F661167 for ; Fri, 9 Jul 2021 18:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbhGISMX (ORCPT ); Fri, 9 Jul 2021 14:12:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58687 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbhGISMW (ORCPT ); Fri, 9 Jul 2021 14:12:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625854178; 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: references:references; bh=SKuk+h7htDa9dNYFdUt3m5hrD3QQHm7oWsA1+l2m0cc=; b=Ogu491bUOGwf3zoTRkm6fhMqCjZzBELaLIL/WOCsikOL72XfOR6zR28U52mSHH92tZYlZw +lzt+U6l07HY/oNTuPyuU5a2NlJUCKC9JTkyN6o51UQvxiP5anEXYhNUscSUM7hg+MSU9b zg9rRvSCy4eta03+O8B2r9+2VjMwEf0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-gMsdvgywNtOq7SK-qL-SOA-1; Fri, 09 Jul 2021 14:09:37 -0400 X-MC-Unique: gMsdvgywNtOq7SK-qL-SOA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 703F9804301; Fri, 9 Jul 2021 18:09:36 +0000 (UTC) Received: from fuller.cnet (ovpn-112-4.gru2.redhat.com [10.97.112.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A01A1604CD; Fri, 9 Jul 2021 18:09:32 +0000 (UTC) Received: by fuller.cnet (Postfix, from userid 1000) id 48849416D8BC; Fri, 9 Jul 2021 15:09:28 -0300 (-03) Message-ID: <20210709174428.134060506@fuller.cnet> User-Agent: quilt/0.66 Date: Fri, 09 Jul 2021 14:37:27 -0300 From: Marcelo Tosatti To: linux-kernel@vger.kernel.org Cc: Christoph Lameter , Thomas Gleixner , Frederic Weisbecker , Juri Lelli , Nitesh Lal , Peter Zijlstra , Nicolas Saenz , Marcelo Tosatti Subject: [patch 1/5] sched: isolation: introduce quiesce_on_exit_to_usermode isolcpu flags References: <20210709173726.457181806@fuller.cnet> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new isolcpus flag "quiesce_on_exit_to_usermode" to enable quiescing of deferred actions on return to userspace. Signed-off-by: Marcelo Tosatti Index: linux-2.6-vmstat-update/include/linux/sched/isolation.h =================================================================== --- linux-2.6-vmstat-update.orig/include/linux/sched/isolation.h +++ linux-2.6-vmstat-update/include/linux/sched/isolation.h @@ -15,6 +15,7 @@ enum hk_flags { HK_FLAG_WQ = (1 << 6), HK_FLAG_MANAGED_IRQ = (1 << 7), HK_FLAG_KTHREAD = (1 << 8), + HK_FLAG_QUIESCE_URET = (1 << 9), }; #ifdef CONFIG_CPU_ISOLATION Index: linux-2.6-vmstat-update/kernel/sched/isolation.c =================================================================== --- linux-2.6-vmstat-update.orig/kernel/sched/isolation.c +++ linux-2.6-vmstat-update/kernel/sched/isolation.c @@ -173,6 +173,12 @@ static int __init housekeeping_isolcpus_ continue; } + if (!strncmp(str, "quiesce_on_exit_to_usermode,", 28)) { + str += 28; + flags |= HK_FLAG_QUIESCE_URET; + continue; + } + /* * Skip unknown sub-parameter and validate that it is not * containing an invalid character. Index: linux-2.6-vmstat-update/Documentation/admin-guide/kernel-parameters.txt =================================================================== --- linux-2.6-vmstat-update.orig/Documentation/admin-guide/kernel-parameters.txt +++ linux-2.6-vmstat-update/Documentation/admin-guide/kernel-parameters.txt @@ -2124,6 +2124,43 @@ The format of is described above. + quiesce_on_exit_to_usermode + + This flag allows userspace to take preventive measures to + avoid deferred actions and create a OS noise free environment for + the application, by quiescing such activities on + return from syscalls (that is, perform the necessary + background work on return to userspace, rather than allowing + it to happen when userspace is executing, in the form of + an interruption to the application). + + There might be a performance degradation from using this, + on systemcall heavy workloads, for the isolated CPUs. + This option is intended to be used by specialized workloads. + + It should be deprecated in favour of a prctl() interface + to enable this mode (which allows the quiescing to take + place only on select sections of userspace execution, namely + the latency sensitive loops). + + Note: one of the preventive measures this option + enables is the following. + + Page counters are maintained in per-CPU counters to + improve performance. When a CPU modifies a page counter, + this modification is kept in the per-CPU counter. + Certain activities require a global count, which + involves requesting each CPU to flush its local counters + to the global VM counters. + This flush is implemented via a workqueue item, which + requires scheduling the workqueue task on isolated CPUs. + + To avoid this interruption, quiesce_on_exit_to_usermode + syncs the page counters on each return from system calls. + To ensure the application returns to userspace + with no modified per-CPU counters, its necessary to + use mlockall() in addition to this isolcpus flag. + iucv= [HW,NET] ivrs_ioapic [HW,X86-64]