// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * Copyright(c) 2015-2017 Intel Corporation. */ #include <linux/mm.h> #include <linux/sched/signal.h> #include <linux/device.h> #include <linux/module.h> #include "hfi.h" static unsigned long cache_size = …; module_param(cache_size, ulong, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(…) …; /* * Determine whether the caller can pin pages. * * This function should be used in the implementation of buffer caches. * The cache implementation should call this function prior to attempting * to pin buffer pages in order to determine whether they should do so. * The function computes cache limits based on the configured ulimit and * cache size. Use of this function is especially important for caches * which are not limited in any other way (e.g. by HW resources) and, thus, * could keeping caching buffers. * */ bool hfi1_can_pin_pages(struct hfi1_devdata *dd, struct mm_struct *mm, u32 nlocked, u32 npages) { … } int hfi1_acquire_user_pages(struct mm_struct *mm, unsigned long vaddr, size_t npages, bool writable, struct page **pages) { … } void hfi1_release_user_pages(struct mm_struct *mm, struct page **p, size_t npages, bool dirty) { … }