Skip to content
Snippets Groups Projects
Select Git revision
  • 56a60dd6d619877e9957ba06b92d2f276e3c229d
  • master default
  • virtio-camera
  • venus
  • venus-rebased
  • virgl-blob-fixes
  • staging
  • stable-6.1
  • stable-6.0
  • stable-6.0-staging
  • stable-5.0
  • stable-4.2
  • stable-4.1
  • stable-4.0
  • stable-3.1
  • stable-3.0
  • stable-2.12
  • stable-2.11
  • stable-2.10
  • stable-2.9
  • stable-2.8
  • v7.1.0-rc2
  • v7.1.0-rc1
  • v7.1.0-rc0
  • v7.0.0
  • v7.0.0-rc4
  • v7.0.0-rc3
  • v7.0.0-rc2
  • v7.0.0-rc1
  • v7.0.0-rc0
  • v6.1.1
  • v6.2.0
  • v6.2.0-rc4
  • v6.2.0-rc3
  • v6.2.0-rc2
  • v6.2.0-rc1
  • v6.2.0-rc0
  • v6.0.1
  • v6.1.0
  • v6.1.0-rc4
  • v6.1.0-rc3
41 results

cpu-all.h

Blame
  • padata.c 27.99 KiB
    // SPDX-License-Identifier: GPL-2.0
    /*
     * padata.c - generic interface to process data streams in parallel
     *
     * See Documentation/core-api/padata.rst for more information.
     *
     * Copyright (C) 2008, 2009 secunet Security Networks AG
     * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com>
     *
     * Copyright (c) 2020 Oracle and/or its affiliates.
     * Author: Daniel Jordan <daniel.m.jordan@oracle.com>
     *
     * This program is free software; you can redistribute it and/or modify it
     * under the terms and conditions of the GNU General Public License,
     * version 2, as published by the Free Software Foundation.
     *
     * This program is distributed in the hope 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.,
     * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
     */
    
    #include <linux/completion.h>
    #include <linux/export.h>
    #include <linux/cpumask.h>
    #include <linux/err.h>
    #include <linux/cpu.h>
    #include <linux/padata.h>
    #include <linux/mutex.h>
    #include <linux/sched.h>
    #include <linux/slab.h>
    #include <linux/sysfs.h>
    #include <linux/rcupdate.h>
    
    #define	PADATA_WORK_ONSTACK	1	/* Work's memory is on stack */
    
    struct padata_work {
    	struct work_struct	pw_work;
    	struct list_head	pw_list;  /* padata_free_works linkage */
    	void			*pw_data;
    };
    
    static DEFINE_SPINLOCK(padata_works_lock);
    static struct padata_work *padata_works;
    static LIST_HEAD(padata_free_works);
    
    struct padata_mt_job_state {
    	spinlock_t		lock;
    	struct completion	completion;
    	struct padata_mt_job	*job;
    	int			nworks;
    	int			nworks_fini;
    	unsigned long		chunk_size;
    };
    
    static void padata_free_pd(struct parallel_data *pd);
    static void __init padata_mt_helper(struct work_struct *work);
    
    static int padata_index_to_cpu(struct parallel_data *pd, int cpu_index)
    {
    	int cpu, target_cpu;
    
    	target_cpu = cpumask_first(pd->cpumask.pcpu);
    	for (cpu = 0; cpu < cpu_index; cpu++)
    		target_cpu = cpumask_next(target_cpu, pd->cpumask.pcpu);