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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6999DC433EF for ; Tue, 14 Dec 2021 14:31:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E9D356B0071; Tue, 14 Dec 2021 09:31:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E4D896B0073; Tue, 14 Dec 2021 09:31:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D157D6B0074; Tue, 14 Dec 2021 09:31:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id C44B46B0071 for ; Tue, 14 Dec 2021 09:31:39 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 777FD7BE6F for ; Tue, 14 Dec 2021 14:31:29 +0000 (UTC) X-FDA: 78916637898.13.9049D2F Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by imf08.hostedemail.com (Postfix) with ESMTP id DB66716003A for ; Tue, 14 Dec 2021 14:31:17 +0000 (UTC) Received: by mail-qk1-f180.google.com with SMTP id m186so16871938qkb.4 for ; Tue, 14 Dec 2021 06:31:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=PnyBX2cL3sw5aLNMKdlSdA2yt3vqpypZzbVoHtQrrVM=; b=wZQgz4iU8dcVuhq+qYq/G7JuK2OMB/oVTHlwJL/bGG8B1tlSX7/4hh4ix6KV0qclCe i0p8A7YvgdoSpgXZ/SxRZlPpizsWJShi6R94vn29FY7VRmBOcMDDxHeSIA1NnYhxyNuc d9SPlqd44LLK+PovtTV3viokDxrETGdMx0CFnL6zi4frZMiAmHmjHjVTcG+xzpIL83UH QPOoFB9Qsoc13xmJdPxzR1/IbsYCdSMaxQ4Z+h1pdkhF7y0wmIKTliqukN6tM1HwBG1v 9+KC78lRYmxL23WMEmFgQvThoJ+vPtAVEQr6sUPuT8Ewb3OCafsexZCaYI7y5UahftT+ qZZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PnyBX2cL3sw5aLNMKdlSdA2yt3vqpypZzbVoHtQrrVM=; b=7ttqxCvMUH4HH6kzuzeqv5BN7wNAchG8sbnqHau6ICvda6A0k5TDzOY8RdFi88NFpQ IxjxLO5LRKe2vFK5pry/HlHCN3pFzWNbQN8B7EtqqTjahLHJJGwly4EpeaTFDSKWXLk3 yjBgYj7ex1Q/nDwRN1xAoTi94H6t+KyB2WkRyJKbxg5R0AO73D0LU/5JZevTG+joZIks UBeAKJ8eBTar1oS/gch+93nEDPMgNffezm+b5j49yTmcTRK9FJ01A52UsJB/eohR7lIj oGfxYsm+0WPLw7NuS50OT1HkYfYbjeOOJMVUClU2/hVohEvi/HFy5lAmcnZoOh4pstZo rwEQ== X-Gm-Message-State: AOAM531mHZ75pchmMBu4VtAH0yfdySDCVywIkFr+9wrnX2aMCHOYszTi qo3xEF8T/1lnJ1MKKuuhjdfbgw== X-Google-Smtp-Source: ABdhPJx1zMmj8YSzdBlLGI6WhQ1M3/Q/BXQaLxrVp2mIQvcX/oOglXcHZT24vk553GZmjeLW1YQ7JA== X-Received: by 2002:a37:654f:: with SMTP id z76mr4207368qkb.224.1639492276068; Tue, 14 Dec 2021 06:31:16 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:e1e4]) by smtp.gmail.com with ESMTPSA id o9sm16361qtk.81.2021.12.14.06.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 06:31:15 -0800 (PST) Date: Tue, 14 Dec 2021 15:31:13 +0100 From: Johannes Weiner To: Vlastimil Babka Cc: Matthew Wilcox , Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg , linux-mm@kvack.org, Andrew Morton , patches@lists.linux.dev, Julia Lawall , Luis Chamberlain , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Marco Elver , Michal Hocko , Vladimir Davydov , kasan-dev@googlegroups.com, cgroups@vger.kernel.org Subject: Re: [PATCH v2 22/33] mm: Convert struct page to struct slab in functions used by other subsystems Message-ID: References: <20211201181510.18784-1-vbabka@suse.cz> <20211201181510.18784-23-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211201181510.18784-23-vbabka@suse.cz> X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: DB66716003A X-Stat-Signature: su59ieonnrrtzkk4ejodj8b9cau1jzph Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=wZQgz4iU; spf=pass (imf08.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.180 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-HE-Tag: 1639492277-735963 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, Dec 01, 2021 at 07:14:59PM +0100, Vlastimil Babka wrote: > KASAN, KFENCE and memcg interact with SLAB or SLUB internals through functions > nearest_obj(), obj_to_index() and objs_per_slab() that use struct page as > parameter. This patch converts it to struct slab including all callers, through > a coccinelle semantic patch. > > // Options: --include-headers --no-includes --smpl-spacing include/linux/slab_def.h include/linux/slub_def.h mm/slab.h mm/kasan/*.c mm/kfence/kfence_test.c mm/memcontrol.c mm/slab.c mm/slub.c > // Note: needs coccinelle 1.1.1 to avoid breaking whitespace > > @@ > @@ > > -objs_per_slab_page( > +objs_per_slab( > ... > ) > { ... } > > @@ > @@ > > -objs_per_slab_page( > +objs_per_slab( > ... > ) > > @@ > identifier fn =~ "obj_to_index|objs_per_slab"; > @@ > > fn(..., > - const struct page *page > + const struct slab *slab > ,...) > { > <... > ( > - page_address(page) > + slab_address(slab) > | > - page > + slab > ) > ...> > } > > @@ > identifier fn =~ "nearest_obj"; > @@ > > fn(..., > - struct page *page > + const struct slab *slab > ,...) > { > <... > ( > - page_address(page) > + slab_address(slab) > | > - page > + slab > ) > ...> > } > > @@ > identifier fn =~ "nearest_obj|obj_to_index|objs_per_slab"; > expression E; > @@ > > fn(..., > ( > - slab_page(E) > + E > | > - virt_to_page(E) > + virt_to_slab(E) > | > - virt_to_head_page(E) > + virt_to_slab(E) > | > - page > + page_slab(page) > ) > ,...) > > Signed-off-by: Vlastimil Babka > Cc: Julia Lawall > Cc: Luis Chamberlain > Cc: Andrey Ryabinin > Cc: Alexander Potapenko > Cc: Andrey Konovalov > Cc: Dmitry Vyukov > Cc: Marco Elver > Cc: Johannes Weiner > Cc: Michal Hocko > Cc: Vladimir Davydov > Cc: > Cc: LGTM. Acked-by: Johannes Weiner