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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 701EAC433B4 for ; Fri, 9 Apr 2021 18:56:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 13B406115C for ; Fri, 9 Apr 2021 18:56:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13B406115C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A5BE36B006C; Fri, 9 Apr 2021 14:56:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A2AD16B0070; Fri, 9 Apr 2021 14:56:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8CED76B0071; Fri, 9 Apr 2021 14:56:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0118.hostedemail.com [216.40.44.118]) by kanga.kvack.org (Postfix) with ESMTP id 713AD6B006C for ; Fri, 9 Apr 2021 14:56:46 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3260A184B2F35 for ; Fri, 9 Apr 2021 18:56:46 +0000 (UTC) X-FDA: 78013735212.06.E767785 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id 880F92000250 for ; Fri, 9 Apr 2021 18:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Ty1LGS3v38Chtaw1svPzlAmEjDpxvcnRksGoyQD0C+o=; b=dllxp3SIl7dJb2SWmtFHijzg05 BMWCiqHMAwP4HIGF0KTqW8xzuklitWYigJdw70af2VurVYfGvC7Oxm2N2raBt/q53boGyBc7YtFNr 8AJ3+yj8A3//tQz4Ef/5qaFW+VjQZcybr1RAOmVc/1cVU4jbdipfQjWS2Nok/eYyRSImo4LElQ4bV yifBHCzF1ZT+TFNmmDcUT/sw8pPkUQneDX0gLUrNG9eFz1kwz87nDBEauMz2d2WnZVP4U6XR0pVf4 BnKVa8aQrBqviiX7uH2lUu0jO0ntht0Ii8YGU6z3b3t6GArBRGhx7VAjAYt90WlB/0VHg/tdBvekJ JoY5ctFw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lUwI9-000nMk-Lg; Fri, 09 Apr 2021 18:55:50 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D6AD730001B; Fri, 9 Apr 2021 20:55:39 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BEDE52C49B0B8; Fri, 9 Apr 2021 20:55:39 +0200 (CEST) Date: Fri, 9 Apr 2021 20:55:39 +0200 From: Peter Zijlstra To: Mel Gorman Cc: Linux-MM , Linux-RT-Users , LKML , Chuck Lever , Jesper Dangaard Brouer , Matthew Wilcox , Thomas Gleixner , Ingo Molnar , Michal Hocko , Oscar Salvador Subject: Re: [PATCH 02/11] mm/page_alloc: Convert per-cpu list protection to local_lock Message-ID: References: <20210407202423.16022-1-mgorman@techsingularity.net> <20210407202423.16022-3-mgorman@techsingularity.net> <20210408174244.GG3697@techsingularity.net> <20210409075939.GJ3697@techsingularity.net> <20210409133256.GN3697@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210409133256.GN3697@techsingularity.net> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 880F92000250 X-Stat-Signature: obdjhkfbx8y6g5wohjfobpugzi39gt1k Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf28; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617994606-358177 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 Fri, Apr 09, 2021 at 02:32:56PM +0100, Mel Gorman wrote: > That said, there are some curious users already. > fs/squashfs/decompressor_multi_percpu.c looks like it always uses the > local_lock in CPU 0's per-cpu structure instead of stabilising a per-cpu > pointer. I'm not sure how you read that. You're talking about this: local_lock(&msblk->stream->lock); right? Note that msblk->stream is a per-cpu pointer, so &msblk->stream->lock is that same per-cpu pointer with an offset on. The whole think relies on: &per_cpu_ptr(msblk->stream, cpu)->lock == per_cpu_ptr(&msblk->stream->lock, cpu) Which is true because the lhs: (local_lock_t *)((msblk->stream + per_cpu_offset(cpu)) + offsetof(struct squashfs_stream, lock)) and the rhs: (local_lock_t *)((msblk->stream + offsetof(struct squashfs_stream, lock)) + per_cpu_offset(cpu)) are identical, because addition is associative. > drivers/block/zram/zcomp.c appears to do the same although for > at least one of the zcomp_stream_get() callers, the CPU is pinned for > other reasons (bit spin lock held). I think it happens to work anyway > but it's weird and I'm not a fan. Same thing.