Skip to contentSkip to conversation

Make HWPoison helpers config-independent

PATCH In review Kaitao Cheng 5 participants 12 messages Sep 3 – Sep 26

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Make HWPoison helpers config-independent

Make the HWPoison page flag's test-and-set and test-and-clear accessors available regardless of CONFIG_MEMORY_FAILURE. When memory failure handling is disabled, the accessors return false, matching the absence of HWPoison state and providing a consistent interface across configurations.

Use the config-independent interface in the pmem driver to remove its private test_and_clear_pmem_poison() wrapper and the associated header dependency. No functional change is intended.

Kaitao Cheng (2):
mm/page-flags: Define HWPoison test-and-change helpers unconditionally nvdimm/pmem: Remove test_and_clear_pmem_poison()

 drivers/nvdimm/pmem.c      |  2 +-
 drivers/nvdimm/pmem.h      | 12 ------------
 include/linux/page-flags.h |  1 +
 3 files changed, 2 insertions(+), 13 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)
#1 lore raw

PATCH 1/2 mm/page-flags: Define HWPoison test-and-change helpers unconditionally

From: Kaitao Cheng <[email protected]>

Page flag helpers for configuration-dependent flags provide false or no-op variants so that their users can be independent of the configuration.

The HWPoison helpers do not fully follow this pattern. When CONFIG_MEMORY_FAILURE is enabled, PAGEFLAG() and TESTSCFLAG() provide the regular, test-and-set, and test-and-clear operations. When it is disabled, only PAGEFLAG_FALSE() is instantiated, leaving TestSetPageHWPoison() and TestClearPageHWPoison() undefined.

Use TESTSCFLAG_FALSE() to provide the missing accessors when memory failure handling is disabled. Both accessors return false, which is consistent with HWPoison state being unavailable, and makes the accessor interface consistent across configurations.

---
 include/linux/page-flags.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/page-flags.h +1 -0
index 7a863572adce..a2315ab1dd3a 100644
@@ -656,6 +656,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
 #define __PG_HWPOISON (1UL << PG_hwpoison)
 #else
 PAGEFLAG_FALSE(HWPoison, hwpoison)
+TESTSCFLAG_FALSE(HWPoison, hwpoison)
 #define __PG_HWPOISON 0
 #endif
 
Signature · 1 line
2.50.1 (Apple Git-155)
#6 lore raw

PATCH 2/2 nvdimm/pmem: Remove test_and_clear_pmem_poison()

In reply to Kaitao Cheng

From: Kaitao Cheng <[email protected]>

TestClearPageHWPoison() is now defined regardless of whether CONFIG_MEMORY_FAILURE is enabled, returning false when memory failure handling is unavailable.

The test_and_clear_pmem_poison() wrapper duplicates this configuration handling and has no other pmem-specific behavior.

Call TestClearPageHWPoison() directly and remove the redundant wrapper. This also removes the need to include page-flags.h from pmem.h.

No functional change is intended.

---
 drivers/nvdimm/pmem.c |  2 +-
 drivers/nvdimm/pmem.h | 12 ------------
 2 files changed, 1 insertion(+), 13 deletions(-)
drivers/nvdimm/pmem.c +1 -1
index 30a51c365ce8..5fb86595e8bd 100644
@@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset,
 		 * here since we're in the driver I/O path and
 		 * outstanding I/O requests pin the dev_pagemap.
 		 */
-		if (test_and_clear_pmem_poison(page))
+		if (TestClearPageHWPoison(page))
 			clear_mce_nospec(pfn);
 	}
 }
drivers/nvdimm/pmem.h +0 -12
index a48509f90196..76870505dd79 100644
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __NVDIMM_PMEM_H__
 #define __NVDIMM_PMEM_H__
-#include <linux/page-flags.h>
 #include <linux/badblocks.h>
 #include <linux/memremap.h>
 #include <linux/types.h>
@@ -31,15 +30,4 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
 		long nr_pages, enum dax_access_mode mode, void **kaddr,
 		unsigned long *pfn);
 
-#ifdef CONFIG_MEMORY_FAILURE
-static inline bool test_and_clear_pmem_poison(struct page *page)
-{
-	return TestClearPageHWPoison(page);
-}
-#else
-static inline bool test_and_clear_pmem_poison(struct page *page)
-{
-	return false;
-}
-#endif
 #endif /* __NVDIMM_PMEM_H__ */
Signature · 1 line
2.50.1 (Apple Git-155)
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] mm/page-flags: Define HWPoison test-and-change helpers unconditionally

In reply to Kaitao Cheng
Quoted 15 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

Page flag helpers for configuration-dependent flags provide false or no-op variants so that their users can be independent of the configuration.

The HWPoison helpers do not fully follow this pattern. When CONFIG_MEMORY_FAILURE is enabled, PAGEFLAG() and TESTSCFLAG() provide the regular, test-and-set, and test-and-clear operations. When it is disabled, only PAGEFLAG_FALSE() is instantiated, leaving TestSetPageHWPoison() and TestClearPageHWPoison() undefined.

Quoted 6 lines

Use TESTSCFLAG_FALSE() to provide the missing accessors when memory failure handling is disabled. Both accessors return false, which is consistent with HWPoison state being unavailable, and makes the accessor interface consistent across configurations.

Thanks.

Acked-by on v1 2/2
#7 lore raw

Re: [PATCH 2/2] nvdimm/pmem: Remove test_and_clear_pmem_poison()

In reply to Kaitao Cheng
Quoted 13 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

TestClearPageHWPoison() is now defined regardless of whether CONFIG_MEMORY_FAILURE is enabled, returning false when memory failure handling is unavailable.

The test_and_clear_pmem_poison() wrapper duplicates this configuration handling and has no other pmem-specific behavior.

Quoted 6 lines

Call TestClearPageHWPoison() directly and remove the redundant wrapper. This also removes the need to include page-flags.h from pmem.h.

No functional change is intended.

The code becomes simpler.

Thanks.

#3 lore raw

Re: [PATCH 1/2] mm/page-flags: Define HWPoison test-and-change helpers unconditionally

In reply to Kaitao Cheng
Quoted 26 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

Page flag helpers for configuration-dependent flags provide false or no-op variants so that their users can be independent of the configuration.

The HWPoison helpers do not fully follow this pattern. When CONFIG_MEMORY_FAILURE is enabled, PAGEFLAG() and TESTSCFLAG() provide the regular, test-and-set, and test-and-clear operations. When it is disabled, only PAGEFLAG_FALSE() is instantiated, leaving TestSetPageHWPoison() and TestClearPageHWPoison() undefined.

Use TESTSCFLAG_FALSE() to provide the missing accessors when memory failure handling is disabled. Both accessors return false, which is consistent with HWPoison state being unavailable, and makes the accessor interface consistent across configurations.

---
 include/linux/page-flags.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/page-flags.h +0 -0
index 7a863572adce..a2315ab1dd3a 100644

include/linux/page-flags.h TESTSCFLAG(HWPoison, hwpoison, PF_ANY) · line 662

Quoted 7 lines
include/linux/page-flags.h +1 -0
@@ -656,6 +656,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
 #define __PG_HWPOISON (1UL << PG_hwpoison)
 #else
 PAGEFLAG_FALSE(HWPoison, hwpoison)
+TESTSCFLAG_FALSE(HWPoison, hwpoison)
 #define __PG_HWPOISON 0
 #endif
 

Can we just squash this patch into #2 please?

Signature · 3 lines
Cheers,

David
maintainer Acked-by on v1 2/2
#8 lore raw

Re: [PATCH 2/2] nvdimm/pmem: Remove test_and_clear_pmem_poison()

In reply to Kaitao Cheng
Quoted 51 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

TestClearPageHWPoison() is now defined regardless of whether CONFIG_MEMORY_FAILURE is enabled, returning false when memory failure handling is unavailable.

The test_and_clear_pmem_poison() wrapper duplicates this configuration handling and has no other pmem-specific behavior.

Call TestClearPageHWPoison() directly and remove the redundant wrapper. This also removes the need to include page-flags.h from pmem.h.

No functional change is intended.

---
 drivers/nvdimm/pmem.c |  2 +-
 drivers/nvdimm/pmem.h | 12 ------------
 2 files changed, 1 insertion(+), 13 deletions(-)
drivers/nvdimm/pmem.c +1 -1
index 30a51c365ce8..5fb86595e8bd 100644
@@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct pmem_device *pmem, phys_addr_t offset,
 		 * here since we're in the driver I/O path and
 		 * outstanding I/O requests pin the dev_pagemap.
 		 */
-		if (test_and_clear_pmem_poison(page))
+		if (TestClearPageHWPoison(page))
 			clear_mce_nospec(pfn);
 	}
 }
drivers/nvdimm/pmem.h +0 -3
index a48509f90196..76870505dd79 100644
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __NVDIMM_PMEM_H__
 #define __NVDIMM_PMEM_H__
-#include <linux/page-flags.h>
 #include <linux/badblocks.h>
 #include <linux/memremap.h>
 #include <linux/types.h>
@@ -31,15 +30,4 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
 		long nr_pages, enum dax_access_mode mode, void **kaddr,
 		unsigned long *pfn);
 
-#ifdef CONFIG_MEMORY_FAILURE
-static inline bool test_and_clear_pmem_poison(struct page *page)

drivers/nvdimm/pmem.h long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, · line 33

Quoted 10 lines
drivers/nvdimm/pmem.h +0 -9
-{
-	return TestClearPageHWPoison(page);
-}
-#else
-static inline bool test_and_clear_pmem_poison(struct page *page)
-{
-	return false;
-}
-#endif
 #endif /* __NVDIMM_PMEM_H__ */

With #1 squashed and the patch description updated accordingly:

Signature · 3 lines
Cheers,

David
Reviewed-by Oscar Salvador on v1 2/2
#9 lore raw

Re: [PATCH 2/2] nvdimm/pmem: Remove test_and_clear_pmem_poison()

In reply to Kaitao Cheng
Quoted 9 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

TestClearPageHWPoison() is now defined regardless of whether CONFIG_MEMORY_FAILURE is enabled, returning false when memory failure handling is unavailable.

The test_and_clear_pmem_poison() wrapper duplicates this configuration handling and has no other pmem-specific behavior.

Quoted 6 lines

Call TestClearPageHWPoison() directly and remove the redundant wrapper. This also removes the need to include page-flags.h from pmem.h.

No functional change is intended.

Nice cleanup, but as David noted, please squash patch#1 into this one.

Signature · 2 lines
Oscar Salvador
SUSE Labs
#10 lore raw

Re: [PATCH 2/2] nvdimm/pmem: Remove test_and_clear_pmem_poison()

Quoted 10 lines · Oscar Salvador (SUSE)
Quoted 9 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

TestClearPageHWPoison() is now defined regardless of whether CONFIG_MEMORY_FAILURE is enabled, returning false when memory failure handling is unavailable.

The test_and_clear_pmem_poison() wrapper duplicates this configuration handling and has no other pmem-specific behavior.

Quoted 8 lines
Quoted 6 lines

Call TestClearPageHWPoison() directly and remove the redundant wrapper. This also removes the need to include page-flags.h from pmem.h.

No functional change is intended.

Nice cleanup, but as David noted, please squash patch#1 into this one.

Although NVDIMM is currently the only external user of TestClearPageHWPoison, I still consider it a generic declaration. Combining the two patches might give the impression that TestClearPageHWPoison exists solely to serve a specific driver.

That said, I’m not opposed to merging the two patches, as doing so would make the submission more concise.

I think both approaches have their own advantages and disadvantages, which is why I haven’t sent a v2 yet.

Quoted 3 lines
Signature · 2 lines
Thanks
Kaitao Cheng
#11 lore raw

Re: [PATCH 2/2] nvdimm/pmem: Remove test_and_clear_pmem_poison()

Quoted 20 lines · Kaitao Cheng
Quoted 10 lines · Oscar Salvador (SUSE)
Quoted 9 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

TestClearPageHWPoison() is now defined regardless of whether CONFIG_MEMORY_FAILURE is enabled, returning false when memory failure handling is unavailable.

The test_and_clear_pmem_poison() wrapper duplicates this configuration handling and has no other pmem-specific behavior.

Quoted 8 lines
Quoted 6 lines

Call TestClearPageHWPoison() directly and remove the redundant wrapper. This also removes the need to include page-flags.h from pmem.h.

No functional change is intended.

Nice cleanup, but as David noted, please squash patch#1 into this one.

Quoted 7 lines

Although NVDIMM is currently the only external user of TestClearPageHWPoison, I still consider it a generic declaration. Combining the two patches might give the impression that TestClearPageHWPoison exists solely to serve a specific driver.

That said, I’m not opposed to merging the two patches, as doing so would make the submission more concise.

Just squash them.

Signature · 3 lines
Cheers,

David
maintainer Acked-by Muchun Song Acked-by David Hildenbrand (Arm) Reviewed-by Oscar Salvador
#4 lore raw

Re: [PATCH 1/2] mm/page-flags: Define HWPoison test-and-change helpers unconditionally

In reply to David Hildenbrand (Arm)
Quoted 22 lines · On Mon, 7 Sep 2026 17:42:11 +0200 "David Hildenbrand (Arm)" <[email protected]>…
Quoted 21 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

Page flag helpers for configuration-dependent flags provide false or no-op variants so that their users can be independent of the configuration.

The HWPoison helpers do not fully follow this pattern. When CONFIG_MEMORY_FAILURE is enabled, PAGEFLAG() and TESTSCFLAG() provide the regular, test-and-set, and test-and-clear operations. When it is disabled, only PAGEFLAG_FALSE() is instantiated, leaving TestSetPageHWPoison() and TestClearPageHWPoison() undefined.

Use TESTSCFLAG_FALSE() to provide the missing accessors when memory failure handling is disabled. Both accessors return false, which is consistent with HWPoison state being unavailable, and makes the accessor interface consistent across configurations.

---
 include/linux/page-flags.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines

include/linux/page-flags.h TESTSCFLAG(HWPoison, hwpoison, PF_ANY) · line 662

Quoted 12 lines
include/linux/page-flags.h +1 -0
index 7a863572adce..a2315ab1dd3a 100644
@@ -656,6 +656,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
 #define __PG_HWPOISON (1UL << PG_hwpoison)
 #else
 PAGEFLAG_FALSE(HWPoison, hwpoison)
+TESTSCFLAG_FALSE(HWPoison, hwpoison)
 #define __PG_HWPOISON 0
 #endif
 

Can we just squash this patch into #2 please?

I did that.

From: Kaitao Cheng <[email protected]>
Subject: mm/page-flags: define HWPoison test-and-change helpers unconditionally
Date: Thu, 3 Sep 2026 13:35:34 +0800

Page flag helpers for configuration-dependent flags provide false or no-op variants so that their users can be independent of the configuration.

The HWPoison helpers do not fully follow this pattern. When CONFIG_MEMORY_FAILURE is enabled, PAGEFLAG() and TESTSCFLAG() provide the regular, test-and-set, and test-and-clear operations. When it is disabled, only PAGEFLAG_FALSE() is instantiated, leaving TestSetPageHWPoison() and TestClearPageHWPoison() undefined.

Use TESTSCFLAG_FALSE() to provide the missing accessors when memory failure handling is disabled. Both accessors return false, which is consistent with HWPoison state being unavailable, and makes the accessor interface consistent across configurations.

Also remove now-unneeded test_and_clear_pmem_poison() from nvdimm/pmem.

---

 drivers/nvdimm/pmem.c      |    2 +-
 drivers/nvdimm/pmem.h      |   12 ------------
 include/linux/page-flags.h |    1 +
 3 files changed, 2 insertions(+), 13 deletions(-)
include/linux/page-flags.h renamed from include/linux/page-flags.h~mm-page-flags-define-hwpoison-test-and-change-helpers-unconditionally +1 -0
@@ -655,6 +655,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
 #define __PG_HWPOISON (1UL << PG_hwpoison)
 #else
 PAGEFLAG_FALSE(HWPoison, hwpoison)
+TESTSCFLAG_FALSE(HWPoison, hwpoison)
 #define __PG_HWPOISON 0
 #endif
 
drivers/nvdimm/pmem.c renamed from drivers/nvdimm/pmem.c~mm-page-flags-define-hwpoison-test-and-change-helpers-unconditionally +1 -1
@@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct p
 		 * here since we're in the driver I/O path and
 		 * outstanding I/O requests pin the dev_pagemap.
 		 */
-		if (test_and_clear_pmem_poison(page))
+		if (TestClearPageHWPoison(page))
 			clear_mce_nospec(pfn);
 	}
 }
drivers/nvdimm/pmem.h renamed from drivers/nvdimm/pmem.h~mm-page-flags-define-hwpoison-test-and-change-helpers-unconditionally +0 -12
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __NVDIMM_PMEM_H__
 #define __NVDIMM_PMEM_H__
-#include <linux/page-flags.h>
 #include <linux/badblocks.h>
 #include <linux/memremap.h>
 #include <linux/types.h>
@@ -31,15 +30,4 @@ long __pmem_direct_access(struct pmem_de
 		long nr_pages, enum dax_access_mode mode, void **kaddr,
 		unsigned long *pfn);
 
-#ifdef CONFIG_MEMORY_FAILURE
-static inline bool test_and_clear_pmem_poison(struct page *page)
-{
-	return TestClearPageHWPoison(page);
-}
-#else
-static inline bool test_and_clear_pmem_poison(struct page *page)
-{
-	return false;
-}
-#endif
 #endif /* __NVDIMM_PMEM_H__ */

_

#5 lore raw

Re: [PATCH 1/2] mm/page-flags: Define HWPoison test-and-change helpers unconditionally

Quoted 39 lines · Andrew Morton
Quoted 22 lines · On Mon, 7 Sep 2026 17:42:11 +0200 "David Hildenbrand (Arm)" <[email protected]>…
Quoted 21 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

Page flag helpers for configuration-dependent flags provide false or no-op variants so that their users can be independent of the configuration.

The HWPoison helpers do not fully follow this pattern. When CONFIG_MEMORY_FAILURE is enabled, PAGEFLAG() and TESTSCFLAG() provide the regular, test-and-set, and test-and-clear operations. When it is disabled, only PAGEFLAG_FALSE() is instantiated, leaving TestSetPageHWPoison() and TestClearPageHWPoison() undefined.

Use TESTSCFLAG_FALSE() to provide the missing accessors when memory failure handling is disabled. Both accessors return false, which is consistent with HWPoison state being unavailable, and makes the accessor interface consistent across configurations.

---
 include/linux/page-flags.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines

include/linux/page-flags.h TESTSCFLAG(HWPoison, hwpoison, PF_ANY) · line 662

Quoted 12 lines
include/linux/page-flags.h +1 -0
index 7a863572adce..a2315ab1dd3a 100644
@@ -656,6 +656,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
 #define __PG_HWPOISON (1UL << PG_hwpoison)
 #else
 PAGEFLAG_FALSE(HWPoison, hwpoison)
+TESTSCFLAG_FALSE(HWPoison, hwpoison)
 #define __PG_HWPOISON 0
 #endif
 

Can we just squash this patch into #2 please?

Quoted 1 line

I did that.

I’ve also posted a v2 version.
https://lore.kernel.org/all/[email protected]/

Quoted 94 lines

From: Kaitao Cheng <[email protected]>
Subject: mm/page-flags: define HWPoison test-and-change helpers unconditionally
Date: Thu, 3 Sep 2026 13:35:34 +0800

Page flag helpers for configuration-dependent flags provide false or no-op variants so that their users can be independent of the configuration.

The HWPoison helpers do not fully follow this pattern. When CONFIG_MEMORY_FAILURE is enabled, PAGEFLAG() and TESTSCFLAG() provide the regular, test-and-set, and test-and-clear operations. When it is disabled, only PAGEFLAG_FALSE() is instantiated, leaving TestSetPageHWPoison() and TestClearPageHWPoison() undefined.

Use TESTSCFLAG_FALSE() to provide the missing accessors when memory failure handling is disabled. Both accessors return false, which is consistent with HWPoison state being unavailable, and makes the accessor interface consistent across configurations.

Also remove now-unneeded test_and_clear_pmem_poison() from nvdimm/pmem.

---

 drivers/nvdimm/pmem.c      |    2 +-
 drivers/nvdimm/pmem.h      |   12 ------------
 include/linux/page-flags.h |    1 +
 3 files changed, 2 insertions(+), 13 deletions(-)
include/linux/page-flags.h renamed from include/linux/page-flags.h~mm-page-flags-define-hwpoison-test-and-change-helpers-unconditionally +1 -0
@@ -655,6 +655,7 @@ TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
 #define __PG_HWPOISON (1UL << PG_hwpoison)
 #else
 PAGEFLAG_FALSE(HWPoison, hwpoison)
+TESTSCFLAG_FALSE(HWPoison, hwpoison)
 #define __PG_HWPOISON 0
 #endif
 
drivers/nvdimm/pmem.c renamed from drivers/nvdimm/pmem.c~mm-page-flags-define-hwpoison-test-and-change-helpers-unconditionally +1 -1
@@ -80,7 +80,7 @@ static void pmem_mkpage_present(struct p
 		 * here since we're in the driver I/O path and
 		 * outstanding I/O requests pin the dev_pagemap.
 		 */
-		if (test_and_clear_pmem_poison(page))
+		if (TestClearPageHWPoison(page))
 			clear_mce_nospec(pfn);
 	}
 }
drivers/nvdimm/pmem.h renamed from drivers/nvdimm/pmem.h~mm-page-flags-define-hwpoison-test-and-change-helpers-unconditionally +0 -12
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __NVDIMM_PMEM_H__
 #define __NVDIMM_PMEM_H__
-#include <linux/page-flags.h>
 #include <linux/badblocks.h>
 #include <linux/memremap.h>
 #include <linux/types.h>
@@ -31,15 +30,4 @@ long __pmem_direct_access(struct pmem_de
 		long nr_pages, enum dax_access_mode mode, void **kaddr,
 		unsigned long *pfn);
 
-#ifdef CONFIG_MEMORY_FAILURE
-static inline bool test_and_clear_pmem_poison(struct page *page)
-{
-	return TestClearPageHWPoison(page);
-}
-#else
-static inline bool test_and_clear_pmem_poison(struct page *page)
-{
-	return false;
-}
-#endif
 #endif /* __NVDIMM_PMEM_H__ */

_

Signature · 2 lines
Thanks
Kaitao Cheng