Received: by 10.192.165.156 with SMTP id m28csp526546imm; Fri, 13 Apr 2018 03:28:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ZmgFxlQOYg5iw0oRe3wZAGBqclG3arem9aGsJQn6TjzhdU1YBFkcDtiBC/Obog8WV9LUd X-Received: by 10.101.70.8 with SMTP id v8mr3671021pgq.336.1523615286640; Fri, 13 Apr 2018 03:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523615286; cv=none; d=google.com; s=arc-20160816; b=WDKhE5joGeST4ZVHt8Cq3szs3wxqoXCNcX9OYMFPgFzIMuz0yPy3ypAflzqqL7mkCR JSOTAARUp94k/lm/AxaAyzjT+l1kPddhxSyim+Iirk4GqhTejrAt32g3DwSaRe+n6ldo bmHAOsJi4yHiVDCqFNJt/OmeZ1Iu8YO0U3sAeqdL+ZQkowEKvNv0p9kdqYgVc3MUDlQ7 6q1AYiXGW1wYdgzvJqWVts4fCEVAZbVlyVVcRnwyqwaZQlFJZkbKzoiR2Aj110cwTaER zLIkZAyzPUf9vFokui1blWq4zWhU5pc4EIryvWiLwrSB9GjZZkrsT0k99ISYkqQs4Zbc uu6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=sHKRvQODT+9R8PdKRSMBFX3MDsVvVHAfmFhrnUI1roQ=; b=Lc9krASmY7SIJ3/TQFFNDmagkD2kGrD4hsW4REkP7l8PUURNxAl2Nd2LNt68WO2dIk IExLg/gvZ08J8wpeCkrDRrmct3t3ueIW89D5VtbNrKnYbl/9sPH8ink/LtbyOoL1+OFY CWTOZT9vO8cnV0gXbsAV55aQv23BG/g5fwozE0L82i5jhG/Z8oz2P7A58c3EZPrfyvvY EPOesYsuanbfcKEVk9pZz3ZgQg6wBkgcPWilAM2I59X8yoOSP18I3VmiHVVijKTAEuej De/pM6k+ha88wFSU9ElICFDhcldtH4IZFba5EslOBVLUaO7Hkmy4rL0gCf0uXAknqFz5 HJ6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si2694125pgp.669.2018.04.13.03.27.52; Fri, 13 Apr 2018 03:28:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753981AbeDMIqw (ORCPT + 99 others); Fri, 13 Apr 2018 04:46:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:51220 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753456AbeDMIqu (ORCPT ); Fri, 13 Apr 2018 04:46:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BFEA5AD93; Fri, 13 Apr 2018 08:46:48 +0000 (UTC) Subject: Re: [PATCH] mm, slab: reschedule cache_reap() on the same CPU To: Minchan Kim Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Joonsoo Kim , David Rientjes , Pekka Enberg , Christoph Lameter , Tejun Heo , Lai Jiangshan , John Stultz , Thomas Gleixner , Stephen Boyd References: <20180410081531.18053-1-vbabka@suse.cz> <20180411070007.32225-1-vbabka@suse.cz> <20180412004747.GA253442@rodete-desktop-imager.corp.google.com> From: Vlastimil Babka Message-ID: <41acaf67-cf4c-e5b2-97e4-2d7d5a383ffb@suse.cz> Date: Fri, 13 Apr 2018 10:44:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180412004747.GA253442@rodete-desktop-imager.corp.google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/12/2018 02:47 AM, Minchan Kim wrote: > On Wed, Apr 11, 2018 at 09:00:07AM +0200, Vlastimil Babka wrote: >> cache_reap() is initially scheduled in start_cpu_timer() via >> schedule_delayed_work_on(). But then the next iterations are scheduled via >> schedule_delayed_work(), i.e. using WORK_CPU_UNBOUND. >> >> Thus since commit ef557180447f ("workqueue: schedule WORK_CPU_UNBOUND work on >> wq_unbound_cpumask CPUs") there is no guarantee the future iterations will run >> on the originally intended cpu, although it's still preferred. I was able to >> demonstrate this with /sys/module/workqueue/parameters/debug_force_rr_cpu. >> IIUC, it may also happen due to migrating timers in nohz context. As a result, >> some cpu's would be calling cache_reap() more frequently and others never. >> >> This patch uses schedule_delayed_work_on() with the current cpu when scheduling >> the next iteration. > > Could you write down part about "so what's the user effect on some condition?". > It would really help to pick up the patch. Ugh, so let's continue the last paragraph with something like: After this patch, cache_reap() executions will always remain on the expected cpu. This can save some memory that could otherwise remain indefinitely in array caches of some cpus or nodes, and prevent waste of cpu cycles by executing cache_reap() too often on other cpus.