Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1993089rwd; Fri, 2 Jun 2023 03:18:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Kiq9AoKXisN2D3t+8cmlnO3K6Cv46OlTnuQOx/ItaHvEDh6y3eBiWZGHgXvL0g5QnzBOw X-Received: by 2002:a17:902:d486:b0:1ad:ea13:1916 with SMTP id c6-20020a170902d48600b001adea131916mr2249417plg.21.1685701138490; Fri, 02 Jun 2023 03:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685701138; cv=none; d=google.com; s=arc-20160816; b=E0kFVPkZLAfWD8vFED8TQYV8n/1i6vyHfOdy1r61d5lfv1OA0zaTsZq7AbyBzFixiO OoAAdjvzvdN9sfWoBFtU751WoVYxsdPYbSMOZ+vMKtqOom1BiYbriqG0V7xKaHTlJ2oE HvW9XPXv2sPvvzmQES5JN+Mi2MpMNPE2PN+PRT7n8Plu5b80i5NbejDTqewyIkWsP4K1 MTnCti+K3E3/C9Iz0BpLeWy6Wyxl4/Im+7sySh2mUa4xvn41IS4VgWTaqNNHJhPJRYuI fgQivAV0xvOYpPDEuldMmab59fXiveLroIAdsaaPsRdRqYMyJ7kCq08miFBfWdcjzUNw b1Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=SNgThRS/mxJXRGAid53owyTPHRL8x+BARghkh0lpZvc=; b=MmKzaOh5On4B0II/5+lXDAmtZkBfHkBXOzsZ7d4lb9zBYFOzjiCIo2lF1HMvR3s8Jg QTfq+NzQBkyp0XH+4oED9KG6uM6DuFHDmpfDhbVLhw/bZJK5EPEG4YlRDO/91HYyIQdG y9vZcWVKIGBd8ugR6EjZ/ZVdv6Y/xC7Ezca5G0pTPeuNlBrhj/AasoCBNEhjHK8tGns2 JNoXFXykeTJzIxaKpOktBhBEM6ydEUU2xXzGqImSJgIobjZnmMtJbtEJKv43yIVhsMgM 0/mI4XF9VogYO41sPkIYkNAkUT6jMUBVduDKOScZaERLy0E9NpCuwtQoERAfXJZTpel+ 6kGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LBuRqYPA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e14-20020a17090301ce00b001a647aadbe0si653049plh.568.2023.06.02.03.18.46; Fri, 02 Jun 2023 03:18:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LBuRqYPA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235125AbjFBKCN (ORCPT + 99 others); Fri, 2 Jun 2023 06:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234629AbjFBKCL (ORCPT ); Fri, 2 Jun 2023 06:02:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95E9BE7 for ; Fri, 2 Jun 2023 03:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685700088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SNgThRS/mxJXRGAid53owyTPHRL8x+BARghkh0lpZvc=; b=LBuRqYPA238o1ffQWWDqhFeh8ouEIwWKyGhaGcGCi82fV6XDtEK6fNJSqbfiXgVZ8qwgIT bREewB04LHcSCRmWLJuuRh6gCx1SjYRSuHv5cByAVRSNKLq5Jb8me8z+T+uj+VQynv0HYR eaATNHh/NnkUBMYLTBZYP3TPv5Xpo70= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-638-oTu0yf2FOjC70MItTOYSKQ-1; Fri, 02 Jun 2023 06:01:27 -0400 X-MC-Unique: oTu0yf2FOjC70MItTOYSKQ-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-30b88392ac6so1015885f8f.0 for ; Fri, 02 Jun 2023 03:01:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685700086; x=1688292086; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SNgThRS/mxJXRGAid53owyTPHRL8x+BARghkh0lpZvc=; b=GhtZsVBXy69fg89DBS65f2ux5DEoYyAxVURfNu4xd/9M4Mi0qLJInfxZkI3cZ1pExc TsALBmLvUPdzmJfO3ba6QwMJEY80zZyKnNDhCTB3vN2i2uSUINMl8u8+V6U4XqnrbQKp B4Y11VFt57NL2Guoih0kTv9rXsUwnIW1Dpyr+9xZC84ISS0oC1ZhrV3jIj/meF9lT6Y2 4jJCvrQgWGINnkkAp1gzh/QJelXOqQwBNqecNYKOGxrijlnhfG09WMouKk0ogy2exR1D M5LKkN1L24K8U+3gcCv8nb5NCAEOZvKHS8M9RXewyjf7SGgFkPt6doTzFI2CiNzer/Ok oYUA== X-Gm-Message-State: AC+VfDw2tUsjHkH48CaHgelm1KUE/VgXfJ4IU1k3vhrPKxPOlz4283iH Lrx/wL4inEfw48CKi22DAnjq6abVyERVdygAQVprNz1uUK0aTTyclWd8prfT/NvAHHKx+H8AFzT 4YP/CvoM7yq5l5fYBy0XSJI9H X-Received: by 2002:a5d:55c9:0:b0:306:26d1:230a with SMTP id i9-20020a5d55c9000000b0030626d1230amr3832720wrw.65.1685700086507; Fri, 02 Jun 2023 03:01:26 -0700 (PDT) X-Received: by 2002:a5d:55c9:0:b0:306:26d1:230a with SMTP id i9-20020a5d55c9000000b0030626d1230amr3832695wrw.65.1685700086152; Fri, 02 Jun 2023 03:01:26 -0700 (PDT) Received: from ?IPV6:2003:d8:2f2e:ae00:f2e3:50e0:73f7:451? (p200300d82f2eae00f2e350e073f70451.dip0.t-ipconnect.de. [2003:d8:2f2e:ae00:f2e3:50e0:73f7:451]) by smtp.gmail.com with ESMTPSA id n2-20020a05600c294200b003f727764b10sm1152850wmd.4.2023.06.02.03.01.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Jun 2023 03:01:25 -0700 (PDT) Message-ID: Date: Fri, 2 Jun 2023 12:01:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 02/12] selftests/mm: fix unused variable warning in hugetlb-madvise.c Content-Language: en-US To: John Hubbard , Andrew Morton Cc: Peter Xu , Shuah Khan , Nathan Chancellor , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML References: <20230602013358.900637-1-jhubbard@nvidia.com> <20230602013358.900637-3-jhubbard@nvidia.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20230602013358.900637-3-jhubbard@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 02.06.23 03:33, John Hubbard wrote: > The dummy variable is required in order to make this work, so declare it > as volatile in order to avoid the clang compiler warning. > > Signed-off-by: John Hubbard > --- > tools/testing/selftests/mm/hugetlb-madvise.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/mm/hugetlb-madvise.c b/tools/testing/selftests/mm/hugetlb-madvise.c > index 28426e30d9bc..3296ccaf7525 100644 > --- a/tools/testing/selftests/mm/hugetlb-madvise.c > +++ b/tools/testing/selftests/mm/hugetlb-madvise.c > @@ -65,7 +65,7 @@ void write_fault_pages(void *addr, unsigned long nr_pages) > > void read_fault_pages(void *addr, unsigned long nr_pages) > { > - unsigned long dummy = 0; > + volatile unsigned long dummy = 0; > unsigned long i; > > for (i = 0; i < nr_pages; i++) The compiler can still decide to optimize it all out, because it's not a global variable. Placing a asm volatile("" : "+r" (dummy)); after the write tells the compiler that the value will be read and cannot be optimized out (we use that trick in the cow selftest and I've been using it in QEMU for the same purpose as well). -- Thanks, David / dhildenb