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=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 20707C433E0 for ; Tue, 16 Jun 2020 16:56:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D16E9208E4 for ; Tue, 16 Jun 2020 16:56:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EHH/Vs+p" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D16E9208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E95B8D0020; Tue, 16 Jun 2020 12:56:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 599F88D0006; Tue, 16 Jun 2020 12:56:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B1E68D0020; Tue, 16 Jun 2020 12:56:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 33FD78D0006 for ; Tue, 16 Jun 2020 12:56:05 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B7AD981621C3 for ; Tue, 16 Jun 2020 16:56:04 +0000 (UTC) X-FDA: 76935677448.07.scent52_401095526e00 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 827BC1818244B for ; Tue, 16 Jun 2020 16:56:04 +0000 (UTC) X-HE-Tag: scent52_401095526e00 X-Filterd-Recvd-Size: 5050 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Tue, 16 Jun 2020 16:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592326563; 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: in-reply-to:in-reply-to:references:references; bh=7kwdzElugV9C6T+0tLjVqlFjwC8qcyyEmVEUfyn6EZ0=; b=EHH/Vs+pJWTfWI4e7ugoSVpYcwW+0NBfTwBC62xLC3uv44hGqc2P5XVtuElRQQFVAItk/L MdouxhNUUs16WhzoY7q5GpZ7kWHJBEJQBVC8p7A3tV7AEkgZFyrkPMeFxDFFBurzkuUJ5g uu71+GWlQQtQMzthyyYzMmeQgr/qAUA= 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-302-NFbTVWW5Otyn-F4Im7ZZ7w-1; Tue, 16 Jun 2020 12:56:01 -0400 X-MC-Unique: NFbTVWW5Otyn-F4Im7ZZ7w-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 BB8F480F5C6; Tue, 16 Jun 2020 16:55:59 +0000 (UTC) Received: from fuller.cnet (ovpn-112-9.gru2.redhat.com [10.97.112.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C19979303; Tue, 16 Jun 2020 16:55:59 +0000 (UTC) Received: by fuller.cnet (Postfix, from userid 1000) id B73D741887FC; Tue, 16 Jun 2020 13:55:23 -0300 (-03) Date: Tue, 16 Jun 2020 13:55:23 -0300 From: Marcelo Tosatti To: Matthew Wilcox Cc: Sebastian Andrzej Siewior , linux-mm@kvack.org, tglx@linutronix.de, frederic@kernel.org, Christoph Lameter , anna-maria@linutronix.de Subject: Re: [PATCH 0/4 v2] mm/swap: Add locking for pagevec Message-ID: <20200616165523.GA324068@fuller.cnet> References: <20190424111208.24459-1-bigeasy@linutronix.de> <20190424121552.GD19031@bombadil.infradead.org> MIME-Version: 1.0 In-Reply-To: <20190424121552.GD19031@bombadil.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 827BC1818244B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Apr 24, 2019 at 05:15:52AM -0700, Matthew Wilcox wrote: > On Wed, Apr 24, 2019 at 01:12:04PM +0200, Sebastian Andrzej Siewior wrote: > > The swap code synchronizes its access to the (four) pagevec struct > > (which is allocated per-CPU) by disabling preemption. This works and the > > one struct needs to be accessed from interrupt context is protected by > > disabling interrupts. This was manually audited and there is no lockdep > > coverage for this. > > There is one case where the per-CPU of a remote CPU needs to be accessed > > and this is solved by started a worker on the remote CPU and waiting for > > it to finish. > > > > In v1 [0] it was attempted to add per-CPU spinlocks for the access to > > struct. This would add lockdep coverage and access from a remote CPU so > > the worker wouldn't be required. > > >From my point of view, what is missing from this description is why we > want to be able to access these structs from a remote CPU. It's explained > a little better in the 4/4 changelog, but I don't see any numbers that > suggest what kinds of gains we might see (eg "reduces power consumption > by x% on a particular setup", or even "average length of time in idle > extended from x ms to y ms"). Willy, This is to avoid: 1) Interrupting CPUs which can't afford executing a workqueue item. 2) To avoid a system lockup when running a busy-spinning (on network RX descriptor) SCHED_FIFO application: [ 7475.821066] INFO: task ld:274531 blocked for more than 600 seconds. [ 7475.822157] Not tainted 4.18.0-208.rt5.20.el8.x86_64 #1 [ 7475.823094] echo 0 /proc/sys/kernel/hung_task_timeout_secs disables this message. [ 7475.824392] ld D 0 274531 274530 0x00084080 [ 7475.825307] Call Trace: [ 7475.825761] __schedule+0x342/0x850 [ 7475.826377] schedule+0x39/0xd0 [ 7475.826923] schedule_timeout+0x20e/0x410 [ 7475.827610] ? __schedule+0x34a/0x850 [ 7475.828247] ? ___preempt_schedule+0x16/0x18 [ 7475.828953] wait_for_completion+0x85/0xe0 [ 7475.829653] flush_work+0x11a/0x1c0 [ 7475.830313] ? flush_workqueue_prep_pwqs+0x130/0x130 [ 7475.831148] drain_all_pages+0x140/0x190 [ 7475.831803] __alloc_pages_slowpath+0x3f8/0xe20 [ 7475.832571] ? mem_cgroup_commit_charge+0xcb/0x510 [ 7475.833371] __alloc_pages_nodemask+0x1ca/0x2b0 [ 7475.834134] pagecache_get_page+0xb5/0x2d0 [ 7475.834814] ? account_page_dirtied+0x11a/0x220 [ 7475.835579] grab_cache_page_write_begin+0x1f/0x40 [ 7475.836379] iomap_write_begin.constprop.44+0x1c1/0x370 [ 7475.837241] ? iomap_write_end+0x91/0x290 [ 7475.837911] iomap_write_actor+0x92/0x170