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.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,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 20800C2BA19 for ; Thu, 9 Apr 2020 17:12:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D410D20678 for ; Thu, 9 Apr 2020 17:12:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="RYDCC4Jl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D410D20678 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6988E8E000F; Thu, 9 Apr 2020 13:12:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 648748E0006; Thu, 9 Apr 2020 13:12:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55D548E000F; Thu, 9 Apr 2020 13:12:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0093.hostedemail.com [216.40.44.93]) by kanga.kvack.org (Postfix) with ESMTP id 4E6178E0006 for ; Thu, 9 Apr 2020 13:12:13 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1159B181AEF3E for ; Thu, 9 Apr 2020 17:12:13 +0000 (UTC) X-FDA: 76688959746.27.smell74_3066840bc335b X-HE-Tag: smell74_3066840bc335b X-Filterd-Recvd-Size: 4478 Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Apr 2020 17:12:12 +0000 (UTC) Received: by mail-qv1-f66.google.com with SMTP id ef12so5844524qvb.11 for ; Thu, 09 Apr 2020 10:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pCU2xV5xu8obgbTJoK3mhGkcTW9yNRTcc3m+RhOgOVg=; b=RYDCC4Jl9wjfkg2GsiRX1VSebxWZMIha+hRNeBoCemJN93/nafGl2oF4ZY33+N2yiC H9z5FhLILe3fk36GlBqouK9ojHoX8TTBPy2mMnV3re0R+68GIELX8bAmk+jelHWEOHt4 MIWyscaJwoTPKfYtlhk8/4bGweVfr/CHMGdYtyyCQdyGPEd0S9gaLZgPUgGrOZ32jKfT 3cwXQvZmLDj13JAZRL2kCf0sh749qJ0LWKDP7kZiDv5BDybLSpzlV0xjn/B1mfJ8r0xK 6/qH2IZFafrr0bAIRTvGsRYUtwdbzwLnU5hRqKIRPdUnV72QPYZ3J3zqSBI0f+th1E7p SUUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pCU2xV5xu8obgbTJoK3mhGkcTW9yNRTcc3m+RhOgOVg=; b=fFoi57+4CnrCJebTkvKODmKZwDE42HWmL39XPMEY9vZePenqFr4zeHJCxhyisEQcjd 0tY+B6K9tjtRc6zBNoZwwJYUVOG3OVCUUU9q9LAawSYf1isvNqUdQOlhZ+t4lH9Q1iDW t5uDLKEPZ2cfnpXRxAr2Cg4O5dJpfoLJFCP7GD14rXrthLogpW7Azg7UqgM09qgEMstI barBGT8hqXXoWmPmZjgO2iry12hq1nQ4cyb/KEB6aPIWkYmc3UzYnloeGmBttpuZ9/WN Qn675wqKU9c1zsVG3HmswsNsqxu6YEVDPhNL6au+oaD/s47e8U6yjBW9CVUlNyhd6LaU gfHQ== X-Gm-Message-State: AGi0PuZ0FJ73TOLbJ8yUPhUjTognzVjoyA/lu8Sl2gZq0p84wqV3t/2g NnDk1d2oe8NrxnL72YXfgSk0Bw== X-Google-Smtp-Source: APiQypJ4BrFxnIjqggYMZVZe9INDX2rAe+/GjgB4kPXSndrpyJxOud4XsscNPPiV+Z2VTT0gHon6jg== X-Received: by 2002:a0c:e7ce:: with SMTP id c14mr1152280qvo.100.1586452331638; Thu, 09 Apr 2020 10:12:11 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id g29sm23102896qte.0.2020.04.09.10.12.10 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Apr 2020 10:12:10 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jMaio-00039C-GH; Thu, 09 Apr 2020 14:12:10 -0300 Date: Thu, 9 Apr 2020 14:12:10 -0300 From: Jason Gunthorpe To: "Kirill A. Shutemov" Cc: Matthew Wilcox , linux-mm@kvack.org, kirill.shutemov@linux.intel.com, pasha.tatashin@soleen.com Subject: Re: [PATCH 1/5] mm: Constify a lot of struct page arguments Message-ID: <20200409171210.GJ11886@ziepe.ca> References: <20200408150148.25290-1-willy@infradead.org> <20200408150148.25290-2-willy@infradead.org> <20200409140914.u3mff4xrk5u4tvht@box> <20200409141550.GU21484@bombadil.infradead.org> <20200409142851.obndv6u7wpo2zovj@box> <20200409143238.GV21484@bombadil.infradead.org> <20200409144744.25bloz245hmtr5rm@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200409144744.25bloz245hmtr5rm@box> User-Agent: Mutt/1.9.4 (2018-02-28) 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 Thu, Apr 09, 2020 at 05:47:44PM +0300, Kirill A. Shutemov wrote: > On Thu, Apr 09, 2020 at 07:32:38AM -0700, Matthew Wilcox wrote: > > On Thu, Apr 09, 2020 at 05:28:51PM +0300, Kirill A. Shutemov wrote: > > > > We have a few places that do things like > > > > > > > > mm/filemap.c: if (unlikely(compound_head(page)->mapping != mapping)) { > > > > > > Good point. > > > > > > Acked-by: Kirill A. Shutemov > > > > Darn, I hoped you'd have a better idea. I feel quite ashamed of this patch. > > I had two ideas. Both awful. > > - Rename compound_head() to __compound_head() or something and make it > return void *. Then wrap it into a macro that would cast return type to > type of the argument. It would allow to regain *some* type safety. > > - Provide two implementations and use C11 _Generic() :P > (bump GCC version requirements first) I saw people using static_assert stuff in the kernel, maybe C11 is feasible now? It is 9 years old.. Jason