Revision 2bbd00aef0671bfe3c2ca5ba67097246257de125 authored by Johannes Weiner on 26 February 2021, 01:16:47 UTC, committed by Linus Torvalds on 26 February 2021, 17:41:00 UTC
On NOHZ, the periodic vmstat flushers on each CPU can go to sleep and
won't wake up until stat changes are detected in the per-cpu deltas of the
zone vmstat counters.

In commit 75ef71840539 ("mm, vmstat: add infrastructure for per-node
vmstats") per-node counters were introduced, and subsequently most stats
were moved from the zone to the node level.  However, the node counters
weren't added to the NOHZ wakeup detection.

In theory this can cause per-cpu errors to remain in the user-reported
stats indefinitely.  In practice this only affects a handful of sub
counters (file_mapped, dirty and writeback e.g.) because other page state
changes at the node level likely involve a change at the zone level as
well (alloc and free, lru ops).  Also, nobody has complained.

Fix it up for completeness: wake up vmstat refreshing on node changes.
Also remove the BUILD_BUG_ONs that assert counter size; we haven't relied
on it since we added sizeof() to the range calculation in commit
13c9aaf7fa01 ("mm/vmstat.c: fix NUMA statistics updates").

Link: https://lkml.kernel.org/r/20210202184342.118513-1-hannes@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent a052d4d
Raw File
hid-tivo.c
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  HID driver for TiVo Slide Bluetooth remote
 *
 *  Copyright (c) 2011 Jarod Wilson <jarod@redhat.com>
 *  based on the hid-topseed driver, which is in turn, based on hid-cherry...
 */

/*
 */

#include <linux/device.h>
#include <linux/hid.h>
#include <linux/module.h>

#include "hid-ids.h"

#define HID_UP_TIVOVENDOR	0xffff0000
#define tivo_map_key_clear(c)	hid_map_usage_clear(hi, usage, bit, max, \
					EV_KEY, (c))

static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
{
	switch (usage->hid & HID_USAGE_PAGE) {
	case HID_UP_TIVOVENDOR:
		switch (usage->hid & HID_USAGE) {
		/* TiVo button */
		case 0x3d: tivo_map_key_clear(KEY_MEDIA);	break;
		/* Live TV */
		case 0x3e: tivo_map_key_clear(KEY_TV);		break;
		/* Red thumbs down */
		case 0x41: tivo_map_key_clear(KEY_KPMINUS);	break;
		/* Green thumbs up */
		case 0x42: tivo_map_key_clear(KEY_KPPLUS);	break;
		default:
			return 0;
		}
		break;
	case HID_UP_CONSUMER:
		switch (usage->hid & HID_USAGE) {
		/* Enter/Last (default mapping: KEY_LAST) */
		case 0x083: tivo_map_key_clear(KEY_ENTER);	break;
		/* Info (default mapping: KEY_PROPS) */
		case 0x209: tivo_map_key_clear(KEY_INFO);	break;
		default:
			return 0;
		}
		break;
	default:
		return 0;
	}

	/* This means we found a matching mapping here, else, look in the
	 * standard hid mappings in hid-input.c */
	return 1;
}

static const struct hid_device_id tivo_devices[] = {
	/* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */
	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) },
	{ }
};
MODULE_DEVICE_TABLE(hid, tivo_devices);

static struct hid_driver tivo_driver = {
	.name = "tivo_slide",
	.id_table = tivo_devices,
	.input_mapping = tivo_input_mapping,
};
module_hid_driver(tivo_driver);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>");
back to top