/* NULL if vaddr invalid OR is not a valid GSEG vaddr.  */
static struct gru_thread_state* gru_find_lock_gts(unsigned long vaddr)
/* NULL if vaddr invalid OR is not a valid GSEG vaddr.  */
static struct gru_thread_state* gru_find_lock_gts(unsigned long vaddr)
{
	struct mm_struct *mm = current->mm;
	struct vm_area_struct *vma;
	struct gru_thread_state *gts = NULL;
	down_read(&mm->mmap_sem);
	vma = gru_find_vma(vaddr);
	if (vma)
		gts = gru_find_thread_state(vma, TSID(vaddr, vma));
	if (gts)
		mutex_lock(&gts->ts_ctxlock);
	else
		up_read(&mm->mmap_sem);
	return gts;
}