mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Revert "Switch KM_SLEEP to KM_PUSHPAGE"
This reverts commit cd5ca4b2f8
due to conflicts in the higher TQ_ bits which caused incorrect
behavior.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
			
			
This commit is contained in:
		
							parent
							
								
									dd87332f47
								
							
						
					
					
						commit
						330fe010e4
					
				@ -62,7 +62,6 @@ typedef struct taskq_ent {
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
#define TQ_SLEEP                KM_SLEEP
 | 
					#define TQ_SLEEP                KM_SLEEP
 | 
				
			||||||
#define TQ_NOSLEEP              KM_NOSLEEP
 | 
					#define TQ_NOSLEEP              KM_NOSLEEP
 | 
				
			||||||
#define TQ_PUSHPAGE             KM_PUSHPAGE
 | 
					 | 
				
			||||||
#define TQ_NOQUEUE              0x01000000
 | 
					#define TQ_NOQUEUE              0x01000000
 | 
				
			||||||
#define TQ_NOALLOC              0x02000000
 | 
					#define TQ_NOALLOC              0x02000000
 | 
				
			||||||
#define TQ_NEW                  0x04000000
 | 
					#define TQ_NEW                  0x04000000
 | 
				
			||||||
 | 
				
			|||||||
@ -50,6 +50,8 @@ task_alloc(taskq_t *tq, uint_t flags)
 | 
				
			|||||||
        SENTRY;
 | 
					        SENTRY;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ASSERT(tq);
 | 
					        ASSERT(tq);
 | 
				
			||||||
 | 
					        ASSERT(flags & (TQ_SLEEP | TQ_NOSLEEP));               /* One set */
 | 
				
			||||||
 | 
					        ASSERT(!((flags & TQ_SLEEP) && (flags & TQ_NOSLEEP))); /* Not both */
 | 
				
			||||||
        ASSERT(spin_is_locked(&tq->tq_lock));
 | 
					        ASSERT(spin_is_locked(&tq->tq_lock));
 | 
				
			||||||
retry:
 | 
					retry:
 | 
				
			||||||
        /* Acquire taskq_ent_t's from free list if available */
 | 
					        /* Acquire taskq_ent_t's from free list if available */
 | 
				
			||||||
@ -552,7 +554,7 @@ __taskq_create(const char *name, int nthreads, pri_t pri,
 | 
				
			|||||||
		nthreads = MAX((num_online_cpus() * nthreads) / 100, 1);
 | 
							nthreads = MAX((num_online_cpus() * nthreads) / 100, 1);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        tq = kmem_alloc(sizeof(*tq), KM_PUSHPAGE);
 | 
					        tq = kmem_alloc(sizeof(*tq), KM_SLEEP);
 | 
				
			||||||
        if (tq == NULL)
 | 
					        if (tq == NULL)
 | 
				
			||||||
                SRETURN(NULL);
 | 
					                SRETURN(NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -578,12 +580,12 @@ __taskq_create(const char *name, int nthreads, pri_t pri,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (flags & TASKQ_PREPOPULATE)
 | 
					        if (flags & TASKQ_PREPOPULATE)
 | 
				
			||||||
                for (i = 0; i < minalloc; i++)
 | 
					                for (i = 0; i < minalloc; i++)
 | 
				
			||||||
                        task_done(tq, task_alloc(tq, TQ_PUSHPAGE | TQ_NEW));
 | 
					                        task_done(tq, task_alloc(tq, TQ_SLEEP | TQ_NEW));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags);
 | 
					        spin_unlock_irqrestore(&tq->tq_lock, tq->tq_lock_flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < nthreads; i++) {
 | 
						for (i = 0; i < nthreads; i++) {
 | 
				
			||||||
		tqt = kmem_alloc(sizeof(*tqt), KM_PUSHPAGE);
 | 
							tqt = kmem_alloc(sizeof(*tqt), KM_SLEEP);
 | 
				
			||||||
		INIT_LIST_HEAD(&tqt->tqt_thread_list);
 | 
							INIT_LIST_HEAD(&tqt->tqt_thread_list);
 | 
				
			||||||
		INIT_LIST_HEAD(&tqt->tqt_active_list);
 | 
							INIT_LIST_HEAD(&tqt->tqt_active_list);
 | 
				
			||||||
		tqt->tqt_tq = tq;
 | 
							tqt->tqt_tq = tq;
 | 
				
			||||||
 | 
				
			|||||||
@ -98,14 +98,14 @@ __thread_create(caddr_t stk, size_t  stksize, thread_func_t func,
 | 
				
			|||||||
	/* Variable stack size unsupported */
 | 
						/* Variable stack size unsupported */
 | 
				
			||||||
	ASSERT(stk == NULL);
 | 
						ASSERT(stk == NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tp = kmem_alloc(sizeof(thread_priv_t), KM_PUSHPAGE);
 | 
						tp = kmem_alloc(sizeof(thread_priv_t), KM_SLEEP);
 | 
				
			||||||
	if (tp == NULL)
 | 
						if (tp == NULL)
 | 
				
			||||||
		SRETURN(NULL);
 | 
							SRETURN(NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tp->tp_magic = TP_MAGIC;
 | 
						tp->tp_magic = TP_MAGIC;
 | 
				
			||||||
	tp->tp_name_size = strlen(name) + 1;
 | 
						tp->tp_name_size = strlen(name) + 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tp->tp_name = kmem_alloc(tp->tp_name_size, KM_PUSHPAGE);
 | 
						tp->tp_name = kmem_alloc(tp->tp_name_size, KM_SLEEP);
 | 
				
			||||||
        if (tp->tp_name == NULL) {
 | 
					        if (tp->tp_name == NULL) {
 | 
				
			||||||
		kmem_free(tp, sizeof(thread_priv_t));
 | 
							kmem_free(tp, sizeof(thread_priv_t));
 | 
				
			||||||
		SRETURN(NULL);
 | 
							SRETURN(NULL);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user