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=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 11F8AC4332B for ; Tue, 24 Mar 2020 07:27:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9546620735 for ; Tue, 24 Mar 2020 07:27:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9546620735 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EC63E6B00D8; Tue, 24 Mar 2020 03:27:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E76D86B00D9; Tue, 24 Mar 2020 03:27:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8C736B00DA; Tue, 24 Mar 2020 03:27:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id BF12A6B00D8 for ; Tue, 24 Mar 2020 03:27:16 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1CD1D12797 for ; Tue, 24 Mar 2020 07:27:17 +0000 (UTC) X-FDA: 76629424914.21.vein70_79bfb6d2a6d15 X-HE-Tag: vein70_79bfb6d2a6d15 X-Filterd-Recvd-Size: 1699 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Mar 2020 07:27:16 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id AE91D68BFE; Tue, 24 Mar 2020 08:27:12 +0100 (CET) Date: Tue, 24 Mar 2020 08:27:12 +0100 From: Christoph Hellwig To: Jason Gunthorpe Cc: Jerome Glisse , Ralph Campbell , Felix.Kuehling@amd.com, linux-mm@kvack.org, John Hubbard , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Christoph Hellwig , Philip Yang , Jason Gunthorpe Subject: Re: [PATCH v2 hmm 2/9] mm/hmm: return the fault type from hmm_pte_need_fault() Message-ID: <20200324072712.GA23447@lst.de> References: <20200324011457.2817-1-jgg@ziepe.ca> <20200324011457.2817-3-jgg@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200324011457.2817-3-jgg@ziepe.ca> User-Agent: Mutt/1.5.17 (2007-11-01) 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 Mon, Mar 23, 2020 at 10:14:50PM -0300, Jason Gunthorpe wrote: > +enum { > + HMM_NEED_FAULT = 1 << 0, > + HMM_NEED_WRITE_FAULT = HMM_NEED_FAULT | (1 << 1), > + HMM_NEED_ALL_BITS = HMM_NEED_FAULT | HMM_NEED_WRITE_FAULT, I have to say I find the compound version of HMM_NEED_WRITE_FAULT way harder to understand than the logic in the previous version, and would refer keeping separate bits here. Mostly beccause of statements like this: > + if ((required_fault & HMM_NEED_WRITE_FAULT) == HMM_NEED_WRITE_FAULT) { which seems rather weird.