msm-4.14/include/linux/zsmalloc.h
Greg Kroah-Hartman 496d5ba9c5 This is the 4.14.224 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmBEqrkACgkQONu9yGCS
 aT7mng//VA/WvCNtcAvP6hP5AIdVpfRERrbS5Ok09KXK12I8OEI4TCUywbDTcm2B
 oTmj84aZILoQstVb7GQSa04tf+2jHZ0z39NLxlyRHbrXzcV0z/6OslQv1y6wZzT4
 +P25fw97BGpAzw0q0YOXgcjyDtAd5+2l2+/Q52lbAqCVKGbr1FItWx8J2CFol2E5
 nul7R8vUbS3z0inFmqEqyixug/RGq6EJHn1HA3RMMO1JWaGTh8FewyVb0ndxcs1F
 zx1f2lVvTIqsJWkJ/9DcyJwdhFPClEpiVPO/5joLanWXEiTAQNJC08BmXJoIAglP
 WB9Sl2vSCCN+DmCjPCxWWF5GL/jnohRd8slKwGrELa5E1YdOkqxIUcI4MKby+fck
 Y9HhjE4OI5L28rGoO1yB3KopnJ6wYCtZSmiHYO6h/dxKMPmRoQ48X5zblPBqFMdu
 Rr/tXSMFCrpoD0QfdevW8K4t4dHWSh8pf9UxGs6Zv3VDv9i7c+zI4xdNCg/XP3LY
 Wm1QKC6pkyQFhzteVswMo3jEhw7kuHLgW+KZNS+gX4AbJ99moJOIpigQlzwsMl0m
 GiKMzrqQ1XwvQH7aQualBkmAYIPcofoshJBvw70MMPS/XGKNArLyTEHu0fzvVTsF
 cKnzxYEMrYJFQd7hoFHhZnSppEQovYKvRmJv8Mo2wvtNS7EuhD0=
 =OFAB
 -----END PGP SIGNATURE-----

Merge 4.14.224 into android-4.14-stable

Changes in 4.14.224
	net: usb: qmi_wwan: support ZTE P685M modem
	scripts: use pkg-config to locate libcrypto
	scripts: set proper OpenSSL include dir also for sign-file
	hugetlb: fix update_and_free_page contig page struct assumption
	drm/virtio: use kvmalloc for large allocations
	virtio/s390: implement virtio-ccw revision 2 correctly
	arm64 module: set plt* section addresses to 0x0
	arm64: Avoid redundant type conversions in xchg() and cmpxchg()
	arm64: cmpxchg: Use "K" instead of "L" for ll/sc immediate constraint
	arm64: Use correct ll/sc atomic constraints
	JFS: more checks for invalid superblock
	media: mceusb: sanity check for prescaler value
	xfs: Fix assert failure in xfs_setattr_size()
	smackfs: restrict bytes count in smackfs write functions
	net: fix up truesize of cloned skb in skb_prepare_for_shift()
	mm/hugetlb.c: fix unnecessary address expansion of pmd sharing
	net: bridge: use switchdev for port flags set through sysfs too
	dt-bindings: net: btusb: DT fix s/interrupt-name/interrupt-names/
	staging: fwserial: Fix error handling in fwserial_create
	x86/reboot: Add Zotac ZBOX CI327 nano PCI reboot quirk
	vt/consolemap: do font sum unsigned
	wlcore: Fix command execute failure 19 for wl12xx
	pktgen: fix misuse of BUG_ON() in pktgen_thread_worker()
	ath10k: fix wmi mgmt tx queue full due to race condition
	x86/build: Treat R_386_PLT32 relocation as R_386_PC32
	Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data
	staging: most: sound: add sanity check for function argument
	media: uvcvideo: Allow entities with no pads
	f2fs: handle unallocated section and zone on pinned/atgc
	parisc: Bump 64-bit IRQ stack size to 64 KB
	scsi: iscsi: Restrict sessions and handles to admin capabilities
	sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output
	scsi: iscsi: Ensure sysfs attributes are limited to PAGE_SIZE
	scsi: iscsi: Verify lengths on passthrough PDUs
	Xen/gnttab: handle p2m update errors on a per-slot basis
	xen-netback: respect gnttab_map_refs()'s return value
	zsmalloc: account the number of compacted pages correctly
	swap: fix swapfile read/write offset
	media: v4l: ioctl: Fix memory leak in video_usercopy
	Linux 4.14.224

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7731282f88441e9aca7a7d31bab9757831b29273
2021-03-07 11:46:40 +01:00

61 lines
1.7 KiB
C

/*
* zsmalloc memory allocator
*
* Copyright (C) 2011 Nitin Gupta
* Copyright (C) 2012, 2013 Minchan Kim
*
* This code is released using a dual license strategy: BSD/GPL
* You can choose the license that better fits your requirements.
*
* Released under the terms of 3-clause BSD License
* Released under the terms of GNU General Public License Version 2.0
*/
#ifndef _ZS_MALLOC_H_
#define _ZS_MALLOC_H_
#include <linux/types.h>
/*
* zsmalloc mapping modes
*
* NOTE: These only make a difference when a mapped object spans pages.
* They also have no effect when PGTABLE_MAPPING is selected.
*/
enum zs_mapmode {
ZS_MM_RW, /* normal read-write mapping */
ZS_MM_RO, /* read-only (no copy-out at unmap time) */
ZS_MM_WO /* write-only (no copy-in at map time) */
/*
* NOTE: ZS_MM_WO should only be used for initializing new
* (uninitialized) allocations. Partial writes to already
* initialized allocations should use ZS_MM_RW to preserve the
* existing data.
*/
};
struct zs_pool_stats {
/* How many pages were migrated (freed) */
atomic_long_t pages_compacted;
};
struct zs_pool;
struct zs_pool *zs_create_pool(const char *name);
void zs_destroy_pool(struct zs_pool *pool);
unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t flags);
void zs_free(struct zs_pool *pool, unsigned long obj);
size_t zs_huge_class_size(struct zs_pool *pool);
void *zs_map_object(struct zs_pool *pool, unsigned long handle,
enum zs_mapmode mm);
void zs_unmap_object(struct zs_pool *pool, unsigned long handle);
unsigned long zs_get_total_pages(struct zs_pool *pool);
unsigned long zs_compact(struct zs_pool *pool);
void zs_pool_stats(struct zs_pool *pool, struct zs_pool_stats *stats);
#endif