Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1739421rdb; Wed, 20 Sep 2023 19:42:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFN4hZjvQELKLkXC8GJFzN9iN2HHWFwAf4NIvE/LHg9ob8zuego1mMQ0LyRfpfyhnH50XAN X-Received: by 2002:a17:90a:9f46:b0:263:41d2:4e2 with SMTP id q6-20020a17090a9f4600b0026341d204e2mr4689366pjv.32.1695264172692; Wed, 20 Sep 2023 19:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695264172; cv=none; d=google.com; s=arc-20160816; b=PgJHB1cgk80F7YySbdBTYGLkC6+RPqa78VnaIdP8gyALM19azGiEpHf3ZEEdM/3EW3 LxOSMoraEnFebayDIqTOXGZrIps2bicdPRBW/545oCYYkFyQ2RH1NBrw+LA2boKI+Xtx fZYq6z+ccmCOcGGv8spf973oTkiqKObHTZdTJo6R+B40/1zhTTPuO5n5U3ZYu07/Pxqq g3YQVh36LZXwr0avp8sCZ8ZBtTDMZ5YuEr7+XjDYcFdcbZJXXbEbpOSEfqP+Ttskx1mN azbXUPs0Z2yrZKwqZTbmnrExcUXnbBmJUL78ksDTLuYKIVwShBA43H//SV1IxgDUT1Hu UZkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VBATFQF6dlOmh7K8WWAThqiY1eLo2LHS4t8VOlA1EXQ=; fh=HLpeUKkJUEvGhWMTOUeXW1ZqUbfbfwfMqSqgFinFgCc=; b=vtoQbt5QRWQHIC5hVeGpgYS5n1A3E6b7kv5G44jb9eNdKknZD86PlVess1OsTg5FDp lUrd+Iz5cnn7wfFwvGEMzNYN/QkcgAbm10nWpJv1c6znY/TVsubnVCrgkxWO4pc9Nbw7 140B3jEILIe3NtC7po21TmY9eFGCKZOSzYPSBSvG2AC6eaj6XtBWZj2taxZXbJ/v+CJ7 i2qHUvta6A0LE0e8zFH8Kll+PEjlFSiPrsCPOhp2nR13LMbGg9rauPnXzysAn37TnLtz Vl68kyihe978LLrmKpwzSLsvwIDDPwEzVfyygXOSCmU9m9gCNCUpM822AvQwR/C9/1A5 Scng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=gl1fHrMt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id v12-20020a17090ae98c00b002740e66851csi554318pjy.150.2023.09.20.19.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 19:42:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=gl1fHrMt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0C83A8370D8D; Wed, 20 Sep 2023 09:58:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235100AbjITQ65 (ORCPT + 99 others); Wed, 20 Sep 2023 12:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235086AbjITQ6x (ORCPT ); Wed, 20 Sep 2023 12:58:53 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5764129 for ; Wed, 20 Sep 2023 09:58:44 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5310a63cf7bso4700168a12.1 for ; Wed, 20 Sep 2023 09:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1695229123; x=1695833923; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VBATFQF6dlOmh7K8WWAThqiY1eLo2LHS4t8VOlA1EXQ=; b=gl1fHrMtnNE1ac77kGMYF1kmi9ir61fLOOA69jVMaOLtOPB9MrvYQ3j8hSRX3Fw7ho IGSrC97oPk5QdLyI/YihvkmKxB7u2vQXvO9jfgcAePh++uq/owuSXHdMFJ/+/4UhbSfo fbHgVsK7OwtZBWI6JACu/fP+Kt08g1cK7tXOY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695229123; x=1695833923; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VBATFQF6dlOmh7K8WWAThqiY1eLo2LHS4t8VOlA1EXQ=; b=sqfbNWWHGohK2AdWHc8K4oPWTpPHeM5wCr3JIqwaeLprKBHu3Awt/q0hwn18foqPvn k6SnVz2CEnLONv5SCq+QT52aW0FURXp1cXHL+fxCyl4y3YynpzemQt7o6MMRouCTTsSf eS9Lb2x/GSEL73W5eBgTM8bqlrcsBFNV4orxCicYY5X94OmajXuR4NH9HwpJnIJ+IHnV d0Zxw4fbu9c2WmHRyYEf7yoJBhfJAXZW3ln8sGmq+bZGvUguTJuOzZqxuuw/w7Nt+iaY 8OL5V9DP6GskvNLv6eIEaVG0EaSUZIJihs7thd2ZXJkeSwTCF/H0BiCAaTUlEwDqZBEV yfWg== X-Gm-Message-State: AOJu0YxMy1ZbsbSUwiG8+nG+Cs6WvPjbhnDgvdJHI1pkUGvH57lEwNRX 5dia6yWod4SC1/1v7XCLPj1qOYQqLOEQHTsiarK4pqM9 X-Received: by 2002:aa7:cfc1:0:b0:522:1f09:dde3 with SMTP id r1-20020aa7cfc1000000b005221f09dde3mr2756425edy.3.1695229122990; Wed, 20 Sep 2023 09:58:42 -0700 (PDT) Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com. [209.85.208.53]) by smtp.gmail.com with ESMTPSA id r16-20020aa7c150000000b0052fe12a864esm9151989edp.57.2023.09.20.09.58.42 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Sep 2023 09:58:42 -0700 (PDT) Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-522bd411679so9080121a12.0 for ; Wed, 20 Sep 2023 09:58:42 -0700 (PDT) X-Received: by 2002:a05:6402:164e:b0:52f:34b3:7c4 with SMTP id s14-20020a056402164e00b0052f34b307c4mr2539957edx.39.1695229121693; Wed, 20 Sep 2023 09:58:41 -0700 (PDT) MIME-Version: 1.0 References: <20230915183707.2707298-1-willy@infradead.org> <20230915183707.2707298-10-willy@infradead.org> <6e409d5f-a419-07b7-c82c-4e80fe19c6ba@westnet.com.au> <5add8ae8-d746-b254-7559-b96aa72d3523@westnet.com.au> In-Reply-To: <5add8ae8-d746-b254-7559-b96aa72d3523@westnet.com.au> From: Linus Torvalds Date: Wed, 20 Sep 2023 09:58:24 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 09/17] m68k: Implement xor_unlock_is_negative_byte To: Greg Ungerer Cc: Matthew Wilcox , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, Nicholas Piggin Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 20 Sep 2023 09:58:56 -0700 (PDT) On Wed, 20 Sept 2023 at 00:45, Greg Ungerer wrote: > > The problem with this C implementation is that need to use loal_irq_save() > which results in some ugly header dependencies trying top include irqflags.h. > > This version at least compiles and run, though we can probably do better still. I was going to say "can't you use CAS?" but apparently coldfire doesn't have that either. What a horrible thing. I do wonder if we should just say "let's use the top bit instead"? The reason we used bit #7 is that - only x86 used to do the clear_bit_unlock_is_negative_byte - it was easy with a simple "andb". - it was just a trivial "move two bits around". but honestly, on x86, doing it with "andl/andq" shouldn't be any worse, and we can still use a (sign-extended) 8-bit immediate value to xor the low seven bits and test the high bit at the same time - so it should be basically exactly the same code sequence. There's a question about mixing access widths - which can be deadly to performance on x86 - but generally this op should be the only op on the page flags in that sequence, and doing a byte access isn't necessarily better. Of course, using the top bit then screws with all the zone/node/section/lru_gen bits that we currently put in the high bits. So it's absolutely *not* just a trivial "move this bit" operation. It would change all the games we do. That might be enough for any sane person to go "this is not worth it", but *if* Willy goes "I like the bit twiddling games", maybe he'd be willing to look at that. I mean, he wrote alpha assembler for this, that certainly says *something* about WIlly ;) Willy? Linus