Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp266348pxb; Wed, 25 Aug 2021 02:42:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ9SxKn/0/EJhEz9hQ2FgTNNNbBSQuk2pZGvPmgfDigeyHnRLmeQCxH/L/K1nvCP1X+wXx X-Received: by 2002:a02:946d:: with SMTP id a100mr38119922jai.118.1629884569187; Wed, 25 Aug 2021 02:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629884569; cv=none; d=google.com; s=arc-20160816; b=zETP6d0aHCQB/N5v1OLeeKB5y+f/I3oPcSpRpM0mmCd0oXEiY9TAgjkltmT0mvBigo 7a0kR6WxZD5G17Nuskpu3BgY+VeVNhRitX1Qu6XK5IVOvufKyAZUEhg7RM4I2ysPy0d9 BJckFu8d3+iEtergQLqUgJt5bqWd4DT6YbATGauq3ab0u167qjo0RNkWIEkJqXMGkoPL fOMX6jcsrqKkdgYX41HStc1+OpHFJA+N9ImSwf3N3dF73REviazayN5qunDRdgDswVNR GNHQwPA9p7TfnWFcHwntY+u+wzccUmPgdrImsLv6z4wrQWSt37CF/kUAJjv+lj12SOOZ bKCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=4KY0geBqernD6flEearvGhfQqxyfGoLkEdAtPT8yID4=; b=0bbspBNmotr4ID5W23CURHja7N/CmxC1H5F/ffaZRLhLEGsExDTHmpImGaBaDcaix1 NpM+KKDavU+YJ8ew0zLSyFXwgqtSRacNMDNQutZENXEoehDM8cmt4kt2vZfvHPQBJqIs 3Ie9nG661bbvLGXJhdu7W3t4XuRb8v8l3shPxat+PGAD2USYGJOlmg4M8zBgok6AS5RI qjYCerZO6VpI126D9Sd6cowMArqY4Qv1r/k+0Gyagee2/L/9QkUf//W8RwRn6A+P/NKW SWNo6//kR9eo/tmyBBrBD68rqITZ2NLAA2o63S11dkV+IPzdOn2DfAv2Q87lNGPT1jFb h7ag== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si23354107ila.78.2021.08.25.02.42.37; Wed, 25 Aug 2021 02:42:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234461AbhHYJl0 (ORCPT + 99 others); Wed, 25 Aug 2021 05:41:26 -0400 Received: from vmi485042.contaboserver.net ([161.97.139.209]:34606 "EHLO gentwo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235365AbhHYJl0 (ORCPT ); Wed, 25 Aug 2021 05:41:26 -0400 X-Greylist: delayed 595 seconds by postgrey-1.27 at vger.kernel.org; Wed, 25 Aug 2021 05:41:25 EDT Received: by gentwo.de (Postfix, from userid 1001) id C21F2B0021C; Wed, 25 Aug 2021 11:30:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by gentwo.de (Postfix) with ESMTP id C16DDB00125; Wed, 25 Aug 2021 11:30:43 +0200 (CEST) Date: Wed, 25 Aug 2021 11:30:43 +0200 (CEST) From: Christoph Lameter To: Marcelo Tosatti cc: linux-kernel@vger.kernel.org, Nitesh Lal , Nicolas Saenz Julienne , Frederic Weisbecker , Juri Lelli , Peter Zijlstra , Alex Belits , Peter Xu Subject: Re: [patch V3 8/8] mm: vmstat_refresh: avoid queueing work item if cpu stats are clean In-Reply-To: <20210824152646.948424573@fuller.cnet> Message-ID: References: <20210824152423.300346181@fuller.cnet> <20210824152646.948424573@fuller.cnet> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Aug 2021, Marcelo Tosatti wrote: > It is not necessary to queue work item to run refresh_vm_stats > on a remote CPU if that CPU has no dirty stats and no per-CPU > allocations for remote nodes. The issue in the past was whether the effort to check is adding overhead that is comparable to run refresh_vm_stats. YMMV. > This fixes sosreport hang (which uses vmstat_refresh) with > spinning SCHED_FIFO process. Ughhh.. SCHED_FIFO is evil.... > #ifdef CONFIG_PROC_FS > +static bool need_drain_remote_zones(int cpu) Well this is not related to vm stats but per cpu pages of the page allocator. Maybe call this need_drain_remote_pcp or something? > @@ -1860,8 +1885,12 @@ int vmstat_refresh(struct ctl_table *tab > void *buffer, size_t *lenp, loff_t *ppos) > { > long val; > - int err; > - int i; > + int i, cpu; > + struct work_struct __percpu *works; > + > + works = alloc_percpu(struct work_struct); Do malloc instead? Using the percpu allocator frequently in a function to allocator temporary variables can cause needless fragmentation there. The percpu allocator does not have the frag management features of the slab allocators.