From patchwork Wed Jun 5 22:36:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 13687636 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCA3215FD07 for ; Wed, 5 Jun 2024 22:36:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717627013; cv=none; b=mtz6mIsSviJeimEFF7SbetH+7MzOhwPSCKpQB1frOol4qcdYqxFdk3zJLAV+XWlBA5FkKNAZ+blvAHkAaZfwoc/pzrMTEFkBRLA9r0aNZQnsUK9O1PwOT+BJ/g7KjJRZN6Bibq2OIbOJcZJtVLR4GPER//D+sxKY4CWxTzk3gL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717627013; c=relaxed/simple; bh=YoSBzgIyczq0SKCblGNBogA192bjVxhivYiaa+qfXhE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=N/WfEXoArW345xoaYXifmAk1RmClKZLnxn4qplS44uaRcyPciKm4uYDoNZH8n9fwLUVMk4I8zMvNBUvDIL0iI00YKnFIre4z1AyG4Bjn5iQQXCn2xN6zS5OGmWf/Db+jgXpBqN3QgwokohWG2Dljg5+B1CEifmuDCLy18rrE++o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Xl7hNSDy; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Xl7hNSDy" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-703f8e691faso264271b3a.0 for ; Wed, 05 Jun 2024 15:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717627011; x=1718231811; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=W09wuD4FxLrgIE1KeD5W+uP9/uZWU9NhM8LDAnFpogw=; b=Xl7hNSDypGwWWw7y2OzzILnVdo767cPxrMUU3eifTvp2UZ3o80tu07Gu/TKVVENXh1 ugnLZfYxOKZ47qLSgxV+NozItwUaa5B7bHWw0lahtyhshXmvmMFKp90QHGBjnCIWnM3Y ij7TGvKlRcEKQ1B15FLm+1dromJw9cR55WmuzSRmVEXbf0YSa/UV7jgnBvgQi9idJf13 3XtjYFocUe2EniX59pty2JL+zAOF5J5/ynR1zCUp6bCdVf3GKPrakHj4V6cXvKyOerkD mxxa4EDmgEC2bg48M1vDR8XsupB54kr67/KDLoTaZN7hKwq6rqafhZXEpDlY1DdkR0cJ eDIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717627011; x=1718231811; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W09wuD4FxLrgIE1KeD5W+uP9/uZWU9NhM8LDAnFpogw=; b=jU10WgxqNzjVHVNBtv3MjgR3NL05rysU6jpZCSXeL51lOT7KXyAf4HvLmYPYrzVnYd K59KbUNOLBAVfZLDTizmPVL9cPulfIUx2LyT3dpXXoxuwJeYn95zu1trPR/O0w1Anw4a ypU3RlSfmh1QeH91SrTq3MDOfL7W3xMUafA/SiU64rfXxKVUOiIEt447Bzwu+mDQ/g9d tyUU7y2n/NdVWC3TrvDPi49B4ScWoOuI32Q5TWx+49FL/dDyFHZDHB8Fam2Q9RTGy5KD cmDzR04zNEgOURclnNtIB2FHJV5S4xjSMyMcUV6Xvnt1Dkk2mJr07O8infGhHKjcpQH5 VtMQ== X-Forwarded-Encrypted: i=1; AJvYcCWCWw3c4fl0raN84IBN/bIsZwj8QH8HLSQHA2e2LW9PTT10skfR5ZKtbq/Ft6yJJfG/vKWnZ+T+KABnpCiO9caQItxzSm/1HX7QJkdqdXVl X-Gm-Message-State: AOJu0Yyui8sfT073Q8ydSd/ZonvHKmMEaoW0CDJh9oF+N07Mtbm76H8F AwWbNXrJfeHpJ9KBXWWtqPholbFVcTX8/BeTlx+aknwUwA/h3oZoXpA3g4nEOK8sCp6s0AUNH6s HLg== X-Google-Smtp-Source: AGHT+IFMIrLdQe45thJUN1W26E8IgQCgCg3jMfWtuEwXZZmX/GxigF7WD+0J3Zd+VqHvwqAm4zpgp44oOeM= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a05:6a00:4f85:b0:6f0:b53c:dfa5 with SMTP id d2e1a72fcca58-703e5a7f7ecmr58171b3a.5.1717627011007; Wed, 05 Jun 2024 15:36:51 -0700 (PDT) Date: Wed, 5 Jun 2024 22:36:34 +0000 In-Reply-To: <20240605223637.1374969-1-edliaw@google.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605223637.1374969-1-edliaw@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605223637.1374969-2-edliaw@google.com> Subject: [PATCH v1 1/2] selftests/mm: Include linux/mman.h From: Edward Liaw To: shuah@kernel.org, Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton Cc: cmllamas@google.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@android.com, Edward Liaw , llvm@lists.linux.dev, linux-mm@kvack.org thuge-gen defines MAP_HUGE_* macros that are provided by linux/mman.h since 4.15. Removes the macros and includes linux/mman.h instead. Signed-off-by: Edward Liaw Reviewed-by: Carlos Llamas Reviewed-by: Muhammad Usama Anjum Reviewed-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/thuge-gen.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c index ea7fd8fe2876..034635317935 100644 --- a/tools/testing/selftests/mm/thuge-gen.c +++ b/tools/testing/selftests/mm/thuge-gen.c @@ -15,6 +15,7 @@ #define _GNU_SOURCE 1 #include +#include #include #include #include @@ -28,10 +29,6 @@ #include "vm_util.h" #include "../kselftest.h" -#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT) -#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT) -#define MAP_HUGE_SHIFT 26 -#define MAP_HUGE_MASK 0x3f #if !defined(MAP_HUGETLB) #define MAP_HUGETLB 0x40000 #endif From patchwork Wed Jun 5 22:36:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 13687637 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 520DC1607BC for ; Wed, 5 Jun 2024 22:36:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717627015; cv=none; b=KqyRTslXy2kpsRY63FX4ZeVqUrsv8Kqh+Ihk4iQQo/G1cEQr0ISUNM1jcMD02xuV/HGyHg4NvjZ4hAuyFkmMaiK7NuKWfiJebOAAsPZ+QjkTN54EpMYk+EGgGOsvrkjFpAz1eFOwK1JhBx2ZC/l6NWraHqdaDWbhANfBfrJecRs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717627015; c=relaxed/simple; bh=9eIW5Nk9I4U8j48RPo1MRyDNbVsR5OYHwY3uM3dehXE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=FsGPH6qAHBGvwDmxnfu0B4O973MWbeLOlflN+WD5U2AD5SGZA7lkUnLKlZdIh4n7WKD/QBrWGuX/PSWM7xGWj0+TDgbA+pGdn4dvM9VyOg1jBWuigL74dDcK2xeVfn0INnktO3ufzvgK2YXPRzrj/0hnuxbwHKz8ZzFyvRGPo7s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=4lbkGThx; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edliaw.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="4lbkGThx" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62a3dec382eso3617897b3.1 for ; Wed, 05 Jun 2024 15:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717627013; x=1718231813; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=HvR2KzRbeN2y+kQBsoY3woptqhul8uQMwsNjpEueFQI=; b=4lbkGThxkiUpMN/0jwXCXsnJX3PCW4UQENIqDyWnmGotw02/rp5TiIapCC7+pqP/nn EaNCX+m6x1uIQ1OS0qB9q+1feW16DiFlasAh6Yu+A1t143SClI5OL+mny+4YHSZDm/Qz iDlpVVG4c9LjVKyRSX8Zphr352aFBj7rfg9tgukQ50EF97uPyMceZnjz+foFGoMjZsCV 65EqqkxAgsg8GyhAlTSNfYY5t4NuHkuuOQEd9Dil8SBn0FUZctsUuoYXr6Y1GTN/9Nyb lmWmhL5eAfB/QsQKpjWkGQ0m2DlZoz7AeNn6QJTjdAVael8nbB5fSWsr0DThu56v1Y0+ WW8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717627013; x=1718231813; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=HvR2KzRbeN2y+kQBsoY3woptqhul8uQMwsNjpEueFQI=; b=dhQlL6kY3VNu3751vZJGOglrZeMKFLASKMwMuCEiXml/8/WJ/U8/GjQZXwfbGAxlof DphsE2Cx1xiDX39E7odVHmsUmlMPRSyvABQ+MczDdFflhHODwNJDjbfpDcwG7DZWzvw/ 7GbfYQHmgkX+/yB952Bkqe5I3D8IQnoXsl8lfyO9OdpGHz8g1rGxAS0K2p/XAYX4sEPn E0Edt0ArU1pCruD+LWnIJWNsxVHbAQuDCSfdoZ3rXxAWllkQos7r4QIirzcUMBtYmeqL Btk2oSFrn/yCY7HE4SxRFbnZT1eoZhQmjetisAI6CznN44vvdIwHgQrJf8YwKZB/4UNP yAOA== X-Forwarded-Encrypted: i=1; AJvYcCX2QvPXhUgiUA3LQ2XYvEBttZi6z+TreNCb+WD2GGyqtbW86eGyuwUWPGftL6QE+qgJCtEP/9gLDhzo6Dz644u9hz9xlLxES4na22+MK0an X-Gm-Message-State: AOJu0YxIxdNArU9QVtlj3JpnZl1vkfZZIRSAOcthls6OpncVq9a6iyD1 ITxG2CJD5h9SnYzYBJXwSBUNRvXswUGxhwTl5wxTF8ZlZXqZbu9L9dbxkhZvbmQql6wd4GjKgpe 4XQ== X-Google-Smtp-Source: AGHT+IHQMSg3BZwEdpTjqj45BkSGSDIqDJ5xpSLfVCjXGbqd16zv34TQGDGB9Qio8PSsr4E5OLx/pSf4zjw= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a05:690c:6413:b0:620:32ea:e1d4 with SMTP id 00721157ae682-62cc6f92037mr2991207b3.0.1717627013381; Wed, 05 Jun 2024 15:36:53 -0700 (PDT) Date: Wed, 5 Jun 2024 22:36:35 +0000 In-Reply-To: <20240605223637.1374969-1-edliaw@google.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605223637.1374969-1-edliaw@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605223637.1374969-3-edliaw@google.com> Subject: [PATCH v1 2/2] selftests/mm: Guard defines from shm From: Edward Liaw To: shuah@kernel.org, Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton Cc: cmllamas@google.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@android.com, Edward Liaw , llvm@lists.linux.dev, linux-mm@kvack.org thuge-gen.c defines SHM_HUGE_* macros that are provided by the uapi since 4.14. These macros get redefined when compiling with Android's bionic because its sys/shm.h will import the uapi definitions. However if linux/shm.h is included, with glibc, sys/shm.h will clash on some struct definitions: /usr/include/linux/shm.h:26:8: error: redefinition of ‘struct shmid_ds’ 26 | struct shmid_ds { | ^~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/bits/shm.h:45, from /usr/include/x86_64-linux-gnu/sys/shm.h:30: /usr/include/x86_64-linux-gnu/bits/types/struct_shmid_ds.h:24:8: note: originally defined here 24 | struct shmid_ds | ^~~~~~~~ For now, guard the SHM_HUGE_* defines with ifndef to prevent redefinition warnings on Android bionic. Signed-off-by: Edward Liaw Reviewed-by: Carlos Llamas Reviewed-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/thuge-gen.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c index 034635317935..d50dc71cac32 100644 --- a/tools/testing/selftests/mm/thuge-gen.c +++ b/tools/testing/selftests/mm/thuge-gen.c @@ -34,10 +34,18 @@ #endif #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ +#ifndef SHM_HUGE_SHIFT #define SHM_HUGE_SHIFT 26 +#endif +#ifndef SHM_HUGE_MASK #define SHM_HUGE_MASK 0x3f +#endif +#ifndef SHM_HUGE_2MB #define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT) +#endif +#ifndef SHM_HUGE_1GB #define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT) +#endif #define NUM_PAGESIZES 5 #define NUM_PAGES 4