Skip to content
Snippets Groups Projects
Select Git revision
  • ef3acdd820752e0abb5f1ec899025967d0dccf3d
  • master default
  • android-container
  • nanopc-t4
  • for-kernelci
  • WIP-syscall
  • v4.16-rc5
  • v4.16-rc4
  • v4.16-rc3
  • v4.16-rc2
  • v4.16-rc1
  • v4.15
  • v4.15-rc9
  • v4.15-rc8
  • v4.15-rc7
  • v4.15-rc6
  • v4.15-rc5
  • v4.15-rc4
  • v4.15-rc3
  • v4.15-rc2
  • v4.15-rc1
  • v4.14
  • v4.14-rc8
  • v4.14-rc7
  • v4.14-rc6
  • v4.14-rc5
26 results

fpga-region.c

Blame
  • async-thread.c 15.02 KiB
    /*
     * Copyright (C) 2007 Oracle.  All rights reserved.
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public
     * License v2 as published by the Free Software Foundation.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     * General Public License for more details.
     *
     * You should have received a copy of the GNU General Public
     * License along with this program; if not, write to the
     * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     * Boston, MA 021110-1307, USA.
     */
    
    #include <linux/kthread.h>
    #include <linux/list.h>
    #include <linux/spinlock.h>
    #include <linux/freezer.h>
    #include "async-thread.h"
    
    #define WORK_QUEUED_BIT 0
    #define WORK_DONE_BIT 1
    #define WORK_ORDER_DONE_BIT 2
    #define WORK_HIGH_PRIO_BIT 3
    
    /*
     * container for the kthread task pointer and the list of pending work
     * One of these is allocated per thread.
     */
    struct btrfs_worker_thread {
    	/* pool we belong to */
    	struct btrfs_workers *workers;
    
    	/* list of struct btrfs_work that are waiting for service */
    	struct list_head pending;
    	struct list_head prio_pending;
    
    	/* list of worker threads from struct btrfs_workers */
    	struct list_head worker_list;
    
    	/* kthread */
    	struct task_struct *task;
    
    	/* number of things on the pending list */
    	atomic_t num_pending;
    
    	/* reference counter for this struct */
    	atomic_t refs;
    
    	unsigned long sequence;
    
    	/* protects the pending list. */
    	spinlock_t lock;
    
    	/* set to non-zero when this thread is already awake and kicking */
    	int working;
    
    	/* are we currently idle */
    	int idle;
    };
    
    /*
     * helper function to move a thread onto the idle list after it
     * has finished some requests.
     */
    static void check_idle_worker(struct btrfs_worker_thread *worker)