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=-0.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 68EB6C2BA2B for ; Thu, 9 Apr 2020 15:00:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2069020692 for ; Thu, 9 Apr 2020 15:00:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="N6Rb9CLZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2069020692 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C2A648E000D; Thu, 9 Apr 2020 11:00:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BDB0F8E0006; Thu, 9 Apr 2020 11:00:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B18938E000D; Thu, 9 Apr 2020 11:00:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id ABA408E0006 for ; Thu, 9 Apr 2020 11:00:55 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7E705AC0B for ; Thu, 9 Apr 2020 15:00:55 +0000 (UTC) X-FDA: 76688628870.26.feet82_423eae7db5961 X-HE-Tag: feet82_423eae7db5961 X-Filterd-Recvd-Size: 4429 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Apr 2020 15:00:55 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id r17so8149367lff.2 for ; Thu, 09 Apr 2020 08:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uIOBmU3xV+Ov7S0xXhgyBEEdae5Jy1rOMtEVjcJg6jw=; b=N6Rb9CLZWEulPDk4wnxgAoxuVbUlcmjxR6FQfZuuaFAgzkHTMLqwBjb4ANCNYUbBDX ezIAWaKBM9tmsMQv1yEjSmM58DJ0u4FAFYPZ/1x8eoKULpnHsJGWSRPwePAbi9OtpDu5 IOyN362pqKP3Z34vDowz7BOivqFmk7AZujnOClH9b9+4Qg3vmN9sYUwX8ker88933T8/ 3n4Lgc90REkFIGGG02B/KE1zV2XBx1dqLnTIGUOEbuzV4X+ZnP0dRoyK9H0whZVgIE0n CI8u0iWkitig4M8UPnrmVoOQ4ulCiN3srKrD26ra+r+JlBhf8t776exjZu5RZNxgeS7o KjDg== 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; bh=uIOBmU3xV+Ov7S0xXhgyBEEdae5Jy1rOMtEVjcJg6jw=; b=c+WnAkwr4xbVEHiVmavo6wqEi7ACK4cQ/clLw9pn8GVv6GrJuWNIq1WWhma9VYXsot 0AI72tJWjkydgE95y2bqb7uQbUl5A9d+w9Ipe4ALINgVZ9cNNb+hBr4ZuewQZIEXd3+5 r4Fep5kZv/PL28nhqd9EZ1Xd9+8CXgn2jaVzNdeZ/+lNiIs16VTpTvbfVRFil1K4B+EN ncDjmDgIMqkBtixw+qEMaIzXyLuydTVP3Gm1Mxjjv0+hAy1yVPk1BpMdqBHEoRFPaR0E Pf9ShQu1exrucNrnO7GR4qkHAPi2obn4PnC71QdejzmdDQ5YEg69Ocmr0g8YCDg3rTzt +0Qg== X-Gm-Message-State: AGi0Pua9PVhxqkvqjz6jyqHtZf/RwOE2fMEZc77wbY40WI0U4SXLv8Lk qoHI0kUf18mVGsG2DDO8M0vS9g== X-Google-Smtp-Source: APiQypIboJYeAqySIPz3bOz+INB06G3mL/diq21hDpc+uLtA+i7rdAoSoivrFXvV5uC8O70yyrGw6g== X-Received: by 2002:ac2:4199:: with SMTP id z25mr8029047lfh.90.1586444453655; Thu, 09 Apr 2020 08:00:53 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id v9sm15734253ljj.31.2020.04.09.08.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2020 08:00:52 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 60B67102132; Thu, 9 Apr 2020 18:00:52 +0300 (+03) Date: Thu, 9 Apr 2020 18:00:52 +0300 From: "Kirill A. Shutemov" To: Matthew Wilcox Cc: 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: <20200409150052.4g5eikutpzoxmqfe@box> 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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000068, 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 guess a reasonable modification would be to add typechecking to the macros: typecheck(const struct page *, page) Not sure though if it threats const vs non-const as compatible. -- Kirill A. Shutemov